summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 10:03:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 10:03:30 +0000
commitd35df0ad158c14cb28f583f4b26c4196ef23a3f7 (patch)
tree5a1992758772519104eacb5de2c231721876541c /spec/lib
parent3c51da6f5782e53123a7ed5af98ba0828cbfa49f (diff)
downloadgitlab-ce-d35df0ad158c14cb28f583f4b26c4196ef23a3f7.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/visibility_level_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/visibility_level_spec.rb b/spec/lib/gitlab/visibility_level_spec.rb
index 16a05af2216..a249b3a235e 100644
--- a/spec/lib/gitlab/visibility_level_spec.rb
+++ b/spec/lib/gitlab/visibility_level_spec.rb
@@ -96,6 +96,30 @@ describe Gitlab::VisibilityLevel do
end
end
+ describe '.restricted_level?, .non_restricted_level?, and .public_level_restricted?' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:visibility_levels, :expected_status) do
+ nil | false
+ [Gitlab::VisibilityLevel::PRIVATE] | false
+ [Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::INTERNAL] | false
+ [Gitlab::VisibilityLevel::PUBLIC] | true
+ [Gitlab::VisibilityLevel::PUBLIC, Gitlab::VisibilityLevel::INTERNAL] | true
+ end
+
+ with_them do
+ before do
+ stub_application_setting(restricted_visibility_levels: visibility_levels)
+ end
+
+ it 'returns the expected status' do
+ expect(described_class.restricted_level?(Gitlab::VisibilityLevel::PUBLIC)).to eq(expected_status)
+ expect(described_class.non_restricted_level?(Gitlab::VisibilityLevel::PUBLIC)).to eq(!expected_status)
+ expect(described_class.public_visibility_restricted?).to eq(expected_status)
+ end
+ end
+ end
+
describe '#visibility_level_decreased?' do
let(:project) { create(:project, :internal) }