diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-08-24 17:55:43 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-08-26 03:30:01 -0500 |
commit | 96c2672da8edff081702702a4a499bae14d27ff6 (patch) | |
tree | acb695d6d3d76c32f31c7761127bc400e8f8463c /spec/helpers | |
parent | 852f50977111fc11511682217e81cdce908c318f (diff) | |
download | gitlab-ce-96c2672da8edff081702702a4a499bae14d27ff6.tar.gz |
add tests for groups within visibility level helper
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/visibility_level_helper_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb index 428eb664138..9a85fbe5258 100644 --- a/spec/helpers/visibility_level_helper_spec.rb +++ b/spec/helpers/visibility_level_helper_spec.rb @@ -80,7 +80,28 @@ describe VisibilityLevelHelper do end end - describe "Snippet" do + describe "group" do + let(:group) { create(:group, :internal) } + + it "disallows levels" do + expect(disallowed_visibility_level?(group, Gitlab::VisibilityLevel::PUBLIC)).to be_falsey + expect(disallowed_visibility_level?(group, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(disallowed_visibility_level?(group, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + describe "sub-group" do + let(:group) { create(:group, :private) } + let(:subgroup) { create(:group, :private, parent: group) } + + it "disallows levels" do + expect(disallowed_visibility_level?(subgroup, Gitlab::VisibilityLevel::PUBLIC)).to be_truthy + expect(disallowed_visibility_level?(subgroup, Gitlab::VisibilityLevel::INTERNAL)).to be_truthy + expect(disallowed_visibility_level?(subgroup, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + describe "snippet" do let(:snippet) { create(:snippet, :internal) } it "disallows levels" do |