diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-14 17:38:55 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-14 17:38:55 +0300 |
commit | b6ae2def2cb2b1da3ddcb3ceee556628a1147cc4 (patch) | |
tree | 8e3511314feb1261bd28fc84a3710e5501238d72 /spec/controllers | |
parent | 33ccee239ebcac7785c1ad466c1624a43af99c90 (diff) | |
parent | be08490863b76026b8f3ffbc422cb7f5d8b4a6a4 (diff) |
Merge branch 'unsubscribe-from-thread-from-email-footer' into 'master'
Unsubscribe from thread through link in email footer
Closes #3437
![Screenshot_from_2015-12-11_15-35-06](/uploads/cfb3d8737d4757f527995411f103d0ce/Screenshot_from_2015-12-11_15-35-06.png)
![Screenshot_from_2015-12-11_15-35-56](/uploads/9b7121be7ce4b05e5995ca6d38c5bea4/Screenshot_from_2015-12-11_15-35-56.png)
See merge request !2068
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/sent_notification_controller_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/sent_notification_controller_spec.rb b/spec/controllers/sent_notification_controller_spec.rb new file mode 100644 index 00000000000..9ced397bd4a --- /dev/null +++ b/spec/controllers/sent_notification_controller_spec.rb @@ -0,0 +1,26 @@ +require 'rails_helper' + +describe SentNotificationsController, type: :controller do + let(:user) { create(:user) } + let(:issue) { create(:issue, author: user) } + let(:sent_notification) { create(:sent_notification, noteable: issue) } + + describe 'GET #unsubscribe' do + it 'returns a 404 when calling without existing id' do + get(:unsubscribe, id: '0' * 32) + + expect(response.status).to be 404 + end + + context 'calling with id' do + it 'shows a flash message to the user' do + get(:unsubscribe, id: sent_notification.reply_key) + + expect(response.status).to be 302 + + expect(response).to redirect_to new_user_session_path + expect(controller).to set_flash[:notice].to(/unsubscribed/).now + end + end + end +end |