summaryrefslogtreecommitdiff
path: root/spec/controllers/groups/notification_settings_controller_spec.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-04-13 15:42:33 -0300
committerFelipe Artur <felipefac@gmail.com>2016-04-13 15:42:33 -0300
commit5395e6175e77d3cd8800bb9f41c09d59934b502f (patch)
tree2234488f40eb4f7aa6920fbe2ab41b1d6f53e14e /spec/controllers/groups/notification_settings_controller_spec.rb
parent39d853f5bd9492fa8dfc8e07ec11070705d3c879 (diff)
parentc0678f2d281242601560e2646cab1aa8a349c4bb (diff)
downloadgitlab-ce-issue_3508.tar.gz
Merge branch 'master' into issue_3508issue_3508
Diffstat (limited to 'spec/controllers/groups/notification_settings_controller_spec.rb')
-rw-r--r--spec/controllers/groups/notification_settings_controller_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/groups/notification_settings_controller_spec.rb b/spec/controllers/groups/notification_settings_controller_spec.rb
new file mode 100644
index 00000000000..0786e45515a
--- /dev/null
+++ b/spec/controllers/groups/notification_settings_controller_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe Groups::NotificationSettingsController do
+ let(:group) { create(:group) }
+ let(:user) { create(:user) }
+
+ describe '#update' do
+ context 'when not authorized' do
+ it 'redirects to sign in page' do
+ put :update,
+ group_id: group.to_param,
+ notification_setting: { level: :participating }
+
+ expect(response).to redirect_to(new_user_session_path)
+ end
+ end
+
+ context 'when authorized' do
+ before do
+ sign_in(user)
+ end
+
+ it 'returns success' do
+ put :update,
+ group_id: group.to_param,
+ notification_setting: { level: :participating }
+
+ expect(response.status).to eq 200
+ end
+ end
+ end
+end