summaryrefslogtreecommitdiff
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-12-11 14:52:22 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2019-01-31 16:51:54 +0100
commit577812948dd25129e363862cfcb6d9d21d168cc2 (patch)
tree2e2950ad21c275aebcb68fb9cc990786fcf0d2d9 /spec/models/user_spec.rb
parent740f07b1ec16e225a29e4b910e64775dd3985e88 (diff)
downloadgitlab-ce-577812948dd25129e363862cfcb6d9d21d168cc2.tar.gz
Group Guests are no longer able to see merge requests
Group guests will only be displayed merge requests to projects they have a access level to, higher than Reporter. Visible projects will still display the merge requests to Guests
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 33842e74b92..78477ab0a5a 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1997,6 +1997,33 @@ describe User do
expect(subject).to include(accessible)
expect(subject).not_to include(other)
end
+
+ context 'with min_access_level' do
+ let!(:user) { create(:user) }
+ let!(:project) { create(:project, :private, namespace: user.namespace) }
+
+ before do
+ project.add_developer(user)
+ end
+
+ subject { Project.where("EXISTS (?)", user.authorizations_for_projects(min_access_level: min_access_level)) }
+
+ context 'when developer access' do
+ let(:min_access_level) { Gitlab::Access::DEVELOPER }
+
+ it 'includes projects a user has access to' do
+ expect(subject).to include(project)
+ end
+ end
+
+ context 'when owner access' do
+ let(:min_access_level) { Gitlab::Access::OWNER }
+
+ it 'does not include projects with higher access level' do
+ expect(subject).not_to include(project)
+ end
+ end
+ end
end
describe '#authorized_projects', :delete do