diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-01-18 08:17:48 +0100 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-01-18 08:17:48 +0100 |
commit | 3ecb3024a40882896632ff78789713a4552a19ab (patch) | |
tree | e2a250e2434edde20f3e64431fc39d77a4d45977 /spec/controllers/sent_notification_controller_spec.rb | |
parent | 07f5a6f107529a932ca7d657a8473cba1afcba05 (diff) | |
parent | 835f1961e65fe9b4f943b17747b1518c555e8bfd (diff) | |
download | gitlab-ce-docs_refactor.tar.gz |
Merge branch 'master' into docs_refactordocs_refactor
Diffstat (limited to 'spec/controllers/sent_notification_controller_spec.rb')
-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 |