Commit d12c1e90 authored by Marin Jankovski's avatar Marin Jankovski

Test secondary user email removal.

parent 37425618
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
%li %li
%span.light Secondary email: %span.light Secondary email:
%strong= email.email %strong= email.email
= link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-tiny btn btn-remove pull-right", title: 'Remove secondary email' do = link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-tiny btn btn-remove pull-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do
%i.icon-remove %i.icon-remove
%li %li
......
...@@ -21,3 +21,11 @@ Feature: Admin Users ...@@ -21,3 +21,11 @@ Feature: Admin Users
And click edit on my user And click edit on my user
When I submit modified user When I submit modified user
Then I see user attributes changed Then I see user attributes changed
@javascript
Scenario: Remove users secondary email
Given I visit admin users page
And I view the user with secondary email
And I see the secondary email
When I click remove secondary email
Then I should not see secondary email anymore
...@@ -44,4 +44,23 @@ class AdminUsers < Spinach::FeatureSteps ...@@ -44,4 +44,23 @@ class AdminUsers < Spinach::FeatureSteps
step 'click edit on my user' do step 'click edit on my user' do
find("#edit_user_#{current_user.id}").click find("#edit_user_#{current_user.id}").click
end end
step 'I view the user with secondary email' do
@user_with_secondary_email = User.last
@user_with_secondary_email.emails.new(email: "secondary@example.com")
@user_with_secondary_email.save
visit "/admin/users/#{@user_with_secondary_email.username}"
end
step 'I see the secondary email' do
page.should have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}"
end
step 'I click remove secondary email' do
find("#remove_email_#{@user_with_secondary_email.emails.last.id}").click
end
step 'I should not see secondary email anymore' do
page.should_not have_content "Secondary email:"
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