-
Notifications
You must be signed in to change notification settings - Fork 0
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 #858 from scientist-softserv/i446-superadmins-acti…
…vate-users 🎁 Superadmins can activate users
- Loading branch information
Showing
8 changed files
with
56 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
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
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 |
---|---|---|
|
@@ -39,4 +39,31 @@ | |
end | ||
end | ||
end | ||
|
||
context 'as an admin user' do | ||
let(:user) { User.invite!(email: '[email protected]', skip_invitation: true) } | ||
|
||
before do | ||
sign_in create(:admin) | ||
end | ||
|
||
describe 'POST #activate' do | ||
context 'when user is successfully activated' do | ||
before do | ||
post :activate, params: { id: user.id } | ||
end | ||
|
||
it 'accepts the invitation for the user' do | ||
expect(user).not_to be_accepted_or_not_invited | ||
user.reload | ||
expect(user).to be_accepted_or_not_invited | ||
end | ||
|
||
it 'redirects to the admin users path with a success notice' do | ||
expect(response).to redirect_to(admin_users_path) | ||
expect(flash[:notice]).to eq "User \"#{user.email}\" has been successfully activated." | ||
end | ||
end | ||
end | ||
end | ||
end |