From 42bc8eb4da280c1d21dd1982fb67271401cf5732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 11 Apr 2021 20:22:16 +0200 Subject: [PATCH] Test the user experience in organization creation So we check the message with the verification link is present and administrators see the organization in the admin section. --- spec/system/organizations_spec.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/spec/system/organizations_spec.rb b/spec/system/organizations_spec.rb index 97688c9c4..4c151084d 100644 --- a/spec/system/organizations_spec.rb +++ b/spec/system/organizations_spec.rb @@ -2,8 +2,7 @@ require "rails_helper" describe "Organizations" do scenario "Organizations can be created" do - user = User.organizations.find_by(email: "green@peace.com") - expect(user).not_to be + admin = create(:administrator).user visit new_organization_registration_path @@ -16,10 +15,15 @@ describe "Organizations" do click_button "Register" - user = User.organizations.find_by(email: "green@peace.com") - expect(user).to be - expect(user).to be_organization - expect(user.organization).not_to be_verified + expect(page).to have_content "You have been sent a message containing a verification link" + + login_as admin + visit admin_users_path + + within "tr", text: "Greenpeace" do + expect(page).to have_text "organization" + expect(page).to have_text "level_1_user" + end end scenario "Create with invisible_captcha honeypot field", :no_js do