Commit 96c2672d authored by Mike Greiling's avatar Mike Greiling

add tests for groups within visibility level helper

parent 852f5097
...@@ -80,7 +80,28 @@ describe VisibilityLevelHelper do ...@@ -80,7 +80,28 @@ describe VisibilityLevelHelper do
end end
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) } let(:snippet) { create(:snippet, :internal) }
it "disallows levels" do it "disallows levels" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment