diff options
| author | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2015-12-09 11:59:25 +0100 |
|---|---|---|
| committer | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2016-01-09 12:41:22 +0100 |
| commit | 58867eff46dc6886b85bfe5a787341f224d09421 (patch) | |
| tree | 676d1b1705678080f75a17542d998afbd3172a7e /spec/controllers | |
| parent | c81647ae8c5dc68ac8d7dd2970a53b31bc656a1d (diff) | |
| download | gitlab-ce-58867eff46dc6886b85bfe5a787341f224d09421.tar.gz | |
Unsubscribe from thread through link in email footer
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 |
