summaryrefslogtreecommitdiff
path: root/spec/controllers/notification_settings_controller_spec.rb
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-16 18:19:41 +0200
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-16 18:19:41 +0200
commit9f2c992ff1520e35d9b7bc26d603d597bc189618 (patch)
tree17af71363c63d99a15c76b1edcbceddc87bfc12d /spec/controllers/notification_settings_controller_spec.rb
parent64bb0d37d4ef1f8574355019f198e40bc9b70224 (diff)
parent5f42009f8dcc29d559ee415e92c88858e361f063 (diff)
downloadgitlab-ce-9f2c992ff1520e35d9b7bc26d603d597bc189618.tar.gz
Merge remote-tracking branch 'upstream/master' into 28717-additional-metrics-review-branch
Diffstat (limited to 'spec/controllers/notification_settings_controller_spec.rb')
-rw-r--r--spec/controllers/notification_settings_controller_spec.rb23
1 files changed, 18 insertions, 5 deletions
diff --git a/spec/controllers/notification_settings_controller_spec.rb b/spec/controllers/notification_settings_controller_spec.rb
index 9e3a31e1a6b..6b690407ce3 100644
--- a/spec/controllers/notification_settings_controller_spec.rb
+++ b/spec/controllers/notification_settings_controller_spec.rb
@@ -58,7 +58,10 @@ describe NotificationSettingsController do
expect(response.status).to eq 200
expect(notification_setting.level).to eq("custom")
- expect(notification_setting.events).to eq(custom_events)
+
+ custom_events.each do |event, value|
+ expect(notification_setting.event_enabled?(event)).to eq(value)
+ end
end
end
end
@@ -86,7 +89,10 @@ describe NotificationSettingsController do
expect(response.status).to eq 200
expect(notification_setting.level).to eq("custom")
- expect(notification_setting.events).to eq(custom_events)
+
+ custom_events.each do |event, value|
+ expect(notification_setting.event_enabled?(event)).to eq(value)
+ end
end
end
end
@@ -94,7 +100,10 @@ describe NotificationSettingsController do
context 'not authorized' do
let(:private_project) { create(:empty_project, :private) }
- before { sign_in(user) }
+
+ before do
+ sign_in(user)
+ end
it 'returns 404' do
post :create,
@@ -120,7 +129,9 @@ describe NotificationSettingsController do
end
context 'when authorized' do
- before{ sign_in(user) }
+ before do
+ sign_in(user)
+ end
it 'returns success' do
put :update,
@@ -152,7 +163,9 @@ describe NotificationSettingsController do
context 'not authorized' do
let(:other_user) { create(:user) }
- before { sign_in(other_user) }
+ before do
+ sign_in(other_user)
+ end
it 'returns 404' do
put :update,