Commit aca6d367 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add tests for admin managing user identities

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d059c69d
...@@ -28,7 +28,7 @@ Feature: Admin Users ...@@ -28,7 +28,7 @@ Feature: Admin Users
When I submit modified user When I submit modified user
Then I see user attributes changed Then I see user attributes changed
@javascript @javascript
Scenario: Remove users secondary email Scenario: Remove users secondary email
Given I visit admin users page Given I visit admin users page
And I view the user with secondary email And I view the user with secondary email
...@@ -45,3 +45,20 @@ Feature: Admin Users ...@@ -45,3 +45,20 @@ Feature: Admin Users
Then I should see key details Then I should see key details
And I click on remove key And I click on remove key
Then I should see the key removed Then I should see the key removed
Scenario: Show user identities
Given user "Pete" with twitter account
And I visit "Pete" identities page in admin
Then I should see twitter details
Scenario: Update user identities
Given user "Pete" with twitter account
And I visit "Pete" identities page in admin
And I modify twitter identity
Then I should see twitter details updated
Scenario: Remove user identities
Given user "Pete" with twitter account
And I visit "Pete" identities page in admin
And I remove twitter identity
Then I should not see twitter details
...@@ -114,4 +114,40 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps ...@@ -114,4 +114,40 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
step 'I should see the key removed' do step 'I should see the key removed' do
expect(page).not_to have_content 'ssh-rsa Key2' expect(page).not_to have_content 'ssh-rsa Key2'
end end
step 'user "Pete" with twitter account' do
@user = create(:user, name: 'Pete')
@user.identities.create!(extern_uid: '123456', provider: 'twitter')
end
step 'I visit "Pete" identities page in admin' do
visit admin_user_identities_path(@user)
end
step 'I should see twitter details' do
expect(page).to have_content 'Identities for Pete'
expect(page).to have_content 'twitter'
end
step 'I modify twitter identity' do
click_link 'Edit'
fill_in 'identity_extern_uid', with: '654321'
fill_in 'identity_provider', with: 'twitter_updated'
click_button 'Save changes'
end
step 'I should see twitter details updated' do
expect(page).to have_content 'Identities for Pete'
expect(page).to have_content 'twitter_updated'
expect(page).to have_content '654321'
end
step 'I remove twitter identity' do
click_link 'Delete'
end
step 'I should not see twitter details' do
expect(page).to have_content 'Identities for Pete'
expect(page).to_not have_content 'twitter'
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment