Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2019-04-09 18:38:58 +0300
committerAndreas Brandl <abrandl@gitlab.com>2019-04-09 18:38:58 +0300
commit9bc5ed14fe97fe63cd5be30c013c6af978715621 (patch)
tree74e1548a29b4683e94720b346a4fc41a068b2583 /spec/policies/base_policy_spec.rb
parenta6218f1bcd78f656d57330e764d3f98e1fb1f3f3 (diff)
Move Contribution Analytics related spec in spec/features/groups/group_page_with_external_authorization_service_spec to EE
Diffstat (limited to 'spec/policies/base_policy_spec.rb')
-rw-r--r--spec/policies/base_policy_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/policies/base_policy_spec.rb b/spec/policies/base_policy_spec.rb
index c03d95b34db..09be831dcd5 100644
--- a/spec/policies/base_policy_spec.rb
+++ b/spec/policies/base_policy_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe BasePolicy do
+ include ExternalAuthorizationServiceHelpers
+
describe '.class_for' do
it 'detects policy class based on the subject ancestors' do
expect(DeclarativePolicy.class_for(GenericCommitStatus.new)).to eq(CommitStatusPolicy)
@@ -16,4 +18,25 @@ describe BasePolicy do
expect(DeclarativePolicy.class_for(:global)).to eq(GlobalPolicy)
end
end
+
+ describe 'read cross project' do
+ let(:current_user) { create(:user) }
+ let(:user) { create(:user) }
+
+ subject { described_class.new(current_user, [user]) }
+
+ it { is_expected.to be_allowed(:read_cross_project) }
+
+ context 'when an external authorization service is enabled' do
+ before do
+ enable_external_authorization_service_check
+ end
+
+ it { is_expected.not_to be_allowed(:read_cross_project) }
+
+ it 'allows admins' do
+ expect(described_class.new(build(:admin), nil)).to be_allowed(:read_cross_project)
+ end
+ end
+ end
end