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
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