summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-03-30 17:14:21 -0300
committerFelipe Artur <felipefac@gmail.com>2016-04-18 11:12:27 -0300
commit668d6ffa437aa5c920e987beb5de4e8dacbfd00c (patch)
tree0d61586b4cbc49916c9c54a3d710d22609966048 /spec
parent57519565f167cb771ffed504feefe7b0eb37c027 (diff)
downloadgitlab-ce-668d6ffa437aa5c920e987beb5de4e8dacbfd00c.tar.gz
Add specs and fix code
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/groups/group_members_controller_spec.rb19
-rw-r--r--spec/controllers/users_controller_spec.rb22
2 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb
new file mode 100644
index 00000000000..3a4dd2bf1fa
--- /dev/null
+++ b/spec/controllers/groups/group_members_controller_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe Groups::GroupMembersController do
+ let(:user) { create(:user) }
+ let(:group) { create(:group) }
+
+
+ context "When public visibility level is restricted" do
+ before do
+ group.add_owner(user)
+ stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])
+ end
+
+ it 'does not show group members' do
+ get :index, group_id: group.path
+ expect(response.status).to eq(404)
+ end
+ end
+end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 7337ff58be1..f6235c29a17 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -38,6 +38,28 @@ describe UsersController do
end
end
end
+
+ context 'When public visibility level is restricted' do
+ before do
+ stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])
+ end
+
+ context 'when logged out' do
+ it 'renders 404' do
+ get :show, username: user.username
+ expect(response.status).to eq(404)
+ end
+ end
+
+ context 'when logged in' do
+ before { sign_in(user) }
+
+ it 'renders 404' do
+ get :show, username: user.username
+ expect(response.status).to eq(200)
+ end
+ end
+ end
end
describe 'GET #calendar' do