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:
Diffstat (limited to 'spec/helpers/visibility_level_helper_spec.rb')
-rw-r--r--spec/helpers/visibility_level_helper_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb
index cd1fc70bbc1..86b0693af92 100644
--- a/spec/helpers/visibility_level_helper_spec.rb
+++ b/spec/helpers/visibility_level_helper_spec.rb
@@ -284,4 +284,34 @@ RSpec.describe VisibilityLevelHelper do
it { is_expected.to eq(expected) }
end
end
+
+ describe '#visibility_level_options' do
+ let(:user) { build(:user) }
+
+ before do
+ allow(helper).to receive(:current_user).and_return(user)
+ end
+
+ it 'returns the desired mapping' do
+ expected_options = [
+ {
+ level: 0,
+ label: 'Private',
+ description: 'The group and its projects can only be viewed by members.'
+ },
+ {
+ level: 10,
+ label: 'Internal',
+ description: 'The group and any internal projects can be viewed by any logged in user except external users.'
+ },
+ {
+ level: 20,
+ label: 'Public',
+ description: 'The group and any public projects can be viewed without any authentication.'
+ }
+ ]
+
+ expect(helper.visibility_level_options(group)).to eq expected_options
+ end
+ end
end