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.
This commit is contained in:
Javi Martín
2021-04-11 20:22:16 +02:00
parent aff102325a
commit 42bc8eb4da

View File

@@ -2,8 +2,7 @@ require "rails_helper"
describe "Organizations" do describe "Organizations" do
scenario "Organizations can be created" do scenario "Organizations can be created" do
user = User.organizations.find_by(email: "green@peace.com") admin = create(:administrator).user
expect(user).not_to be
visit new_organization_registration_path visit new_organization_registration_path
@@ -16,10 +15,15 @@ describe "Organizations" do
click_button "Register" click_button "Register"
user = User.organizations.find_by(email: "green@peace.com") expect(page).to have_content "You have been sent a message containing a verification link"
expect(user).to be
expect(user).to be_organization login_as admin
expect(user.organization).not_to be_verified 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 end
scenario "Create with invisible_captcha honeypot field", :no_js do scenario "Create with invisible_captcha honeypot field", :no_js do