diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-16 18:08:09 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-20 10:52:57 +0300 |
commit | c61a54f7fe932b9b76ce930aaccb04f897c4093b (patch) | |
tree | 883db81143794881d08d8c376847afc708dc7e3f /spec/features | |
parent | b335730817e096bb4c68e5e4a4a2a3ec29b25243 (diff) |
Fix initial implementation to actually render the unsubscribe page
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/unsubscribe_links_spec.rb | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/spec/features/unsubscribe_links_spec.rb b/spec/features/unsubscribe_links_spec.rb index eafad1a726d..3802f5f1335 100644 --- a/spec/features/unsubscribe_links_spec.rb +++ b/spec/features/unsubscribe_links_spec.rb @@ -19,11 +19,32 @@ describe 'Unsubscribe links', feature: true do end context 'when logged out' do - it 'redirects to the login page when visiting the link from the body' do - visit body_link + context 'when visiting the link from the body' do + it 'shows the unsubscribe confirmation page and redirects to root path when confirming' do + visit body_link + + expect(current_path).to eq unsubscribe_sent_notification_path(SentNotification.last) + expect(page).to have_text(%(Unsubscribe from issue "#{issue.title}" (#{issue.to_reference}))) + expect(page).to have_text(%(Are you sure you want to unsubscribe from issue "#{issue.title}" (#{issue.to_reference})?)) + expect(issue.subscribed?(recipient)).to be_truthy + + click_link 'Unsubscribe' + + expect(issue.subscribed?(recipient)).to be_falsey + expect(current_path).to eq new_user_session_path + end + + it 'shows the unsubscribe confirmation page and redirects to root path when canceling' do + visit body_link + + expect(current_path).to eq unsubscribe_sent_notification_path(SentNotification.last) + expect(issue.subscribed?(recipient)).to be_truthy + + click_link 'Cancel' - expect(current_path).to eq new_user_session_path - expect(issue.subscribed?(recipient)).to be_truthy + expect(issue.subscribed?(recipient)).to be_truthy + expect(current_path).to eq new_user_session_path + end end it 'unsubscribes from the issue when visiting the link from the header' do |