summaryrefslogtreecommitdiff
path: root/spec/controllers/sent_notifications_controller_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-16 17:08:09 +0200
committerRémy Coutable <remy@rymai.me>2016-09-20 09:52:57 +0200
commitc61a54f7fe932b9b76ce930aaccb04f897c4093b (patch)
tree883db81143794881d08d8c376847afc708dc7e3f /spec/controllers/sent_notifications_controller_spec.rb
parentb335730817e096bb4c68e5e4a4a2a3ec29b25243 (diff)
downloadgitlab-ce-c61a54f7fe932b9b76ce930aaccb04f897c4093b.tar.gz
Fix initial implementation to actually render the unsubscribe page
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/controllers/sent_notifications_controller_spec.rb')
-rw-r--r--spec/controllers/sent_notifications_controller_spec.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/controllers/sent_notifications_controller_spec.rb b/spec/controllers/sent_notifications_controller_spec.rb
index 4e75372ffb2..191e290a118 100644
--- a/spec/controllers/sent_notifications_controller_spec.rb
+++ b/spec/controllers/sent_notifications_controller_spec.rb
@@ -41,7 +41,7 @@ describe SentNotificationsController, type: :controller do
end
it 'redirects to the login page' do
- expect(response).to redirect_to(new_user_session_path)
+ expect(response).to render_template :unsubscribe
end
end
end
@@ -83,19 +83,25 @@ describe SentNotificationsController, type: :controller do
end
context 'when the force param is not passed' do
+ let(:merge_request) do
+ create(:merge_request, source_project: project, author: user) do |merge_request|
+ merge_request.subscriptions.create(user: user, subscribed: true)
+ end
+ end
+ let(:sent_notification) { create(:sent_notification, noteable: merge_request, recipient: user) }
before { get(:unsubscribe, id: sent_notification.reply_key) }
it 'unsubscribes the user' do
- expect(issue.subscribed?(user)).to be_falsey
+ expect(merge_request.subscribed?(user)).to be_falsey
end
it 'sets the flash message' do
expect(controller).to set_flash[:notice].to(/unsubscribed/).now
end
- it 'redirects to the issue page' do
+ it 'redirects to the merge request page' do
expect(response).
- to redirect_to(namespace_project_issue_path(project.namespace, project, issue))
+ to redirect_to(namespace_project_merge_request_path(project.namespace, project, merge_request))
end
end
end