-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test that invited users are added to the registered group
- Loading branch information
1 parent
ae6de21
commit ad8444e
Showing
1 changed file
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,31 @@ | |
expect(response).to redirect_to Hyrax::Engine.routes.url_helpers.admin_users_path(locale: 'en') | ||
expect(flash[:notice]).to eq 'An invitation email has been sent to [email protected].' | ||
end | ||
|
||
context 'when user already exists' do | ||
let(:user) { create(:user) } | ||
|
||
# Mimic the state of a user who is only active in other tenants; | ||
# i.e. a user who has no roles in this tenant | ||
before do | ||
user.roles.destroy_all | ||
end | ||
|
||
it 'adds the user to the registered group' do | ||
expect(user.roles).to be_empty | ||
expect(user.groups).to be_empty | ||
|
||
post :create, params: { | ||
user: { | ||
email: user.email, | ||
role: '' | ||
} | ||
} | ||
|
||
user.reload | ||
expect(user.roles).not_to be_empty | ||
expect(user.groups).to eq([Ability.registered_group_name]) | ||
end | ||
end | ||
end | ||
end |