-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from commercekitchen/develop
Merge develop into master
- Loading branch information
Showing
3 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'feature_helper' | ||
|
||
feature 'Admin user invites other admins' do | ||
let(:org) { FactoryBot.create(:organization) } | ||
let(:user) { FactoryBot.create(:user, :admin, organization: org) } | ||
|
||
before(:each) do | ||
switch_to_subdomain(org.subdomain) | ||
login_as user | ||
end | ||
|
||
scenario 'submits blank form', js: true do | ||
visit new_user_invitation_path | ||
expect(page).to have_content 'Invite Admin' | ||
|
||
click_button 'Send Invitation' | ||
|
||
expect(current_path).to eq(new_user_invitation_path) | ||
end | ||
|
||
scenario 'attempts to invite user with invalid email' do | ||
visit new_user_invitation_path | ||
expect(page).to have_content 'Invite Admin' | ||
|
||
fill_in 'Email', with: 'foobar notanemail' | ||
|
||
click_button 'Send Invitation' | ||
|
||
expect(page).to have_content('Email is invalid') | ||
end | ||
|
||
scenario 'invites user with valid email' do | ||
visit new_user_invitation_path | ||
expect(page).to have_content 'Invite Admin' | ||
|
||
fill_in 'Email', with: '[email protected]' | ||
|
||
click_button 'Send Invitation' | ||
|
||
success_message = 'An invitation email has been sent to [email protected].' | ||
|
||
expect(page).to have_content(success_message) | ||
expect(current_path).to eq(root_path) | ||
end | ||
|
||
end |