Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-16 18:08:09 +0300
committerRémy Coutable <remy@rymai.me>2016-09-20 10:52:57 +0300
commitc61a54f7fe932b9b76ce930aaccb04f897c4093b (patch)
tree883db81143794881d08d8c376847afc708dc7e3f /spec/features/unsubscribe_links_spec.rb
parentb335730817e096bb4c68e5e4a4a2a3ec29b25243 (diff)
Fix initial implementation to actually render the unsubscribe page
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features/unsubscribe_links_spec.rb')
-rw-r--r--spec/features/unsubscribe_links_spec.rb29
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