diff --git a/features/steps/user.rb b/features/steps/user.rb index 5fb248ffcb..04e3853137 100644 --- a/features/steps/user.rb +++ b/features/steps/user.rb @@ -7,4 +7,20 @@ class Spinach::Features::User < Spinach::FeatureSteps step 'I should see user "John Doe" page' do expect(page.title).to match(/^\s*John Doe/) end + + step 'I visit unsubscribe link' do + visit "/unsubscribes/joh@doe.org" + end + + step 'I should see unsubscribe text and button' do + page.should have_content "Unsubscribe from Admin notifications Yes, I want to unsubscribe joh@doe.org from any further admin emails." + end + + step 'I press the unsubscribe button' do + click_button("Unsubscribe") + end + + step 'I should be unsubscribed' do + current_path.should == root_path + end end diff --git a/features/user.feature b/features/user.feature index a2167935fd..1779bd62a8 100644 --- a/features/user.feature +++ b/features/user.feature @@ -67,3 +67,10 @@ Feature: User And I should see project "Enterprise" And I should not see project "Internal" And I should not see project "Community" + + Scenario: I unsubscribe from admin notifications + Given I sign in as "John Doe" + When I visit unsubscribe link + Then I should see unsubscribe text and button + And I press the unsubscribe button + Then I should be unsubscribed