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:
authorMike Greiling <mike@pixelcog.com>2017-08-25 23:40:21 +0300
committerMike Greiling <mike@pixelcog.com>2017-08-26 11:31:14 +0300
commit1c3b3facb7a2296ca10dcb57b4f3b8ba416ffd3b (patch)
tree19a9e87ef4fdfb3ffc0d07d001641f52dc7d2a12 /spec/helpers/visibility_level_helper_spec.rb
parentaff72ece729ab33afa8c3a4a83e97c5383ce5ed8 (diff)
add tests for new visibility_level_helper methods
Diffstat (limited to 'spec/helpers/visibility_level_helper_spec.rb')
-rw-r--r--spec/helpers/visibility_level_helper_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb
index 9a85fbe5258..bd15abf5469 100644
--- a/spec/helpers/visibility_level_helper_spec.rb
+++ b/spec/helpers/visibility_level_helper_spec.rb
@@ -111,4 +111,30 @@ describe VisibilityLevelHelper do
end
end
end
+
+ describe "disallowed_visibility_level_description" do
+ let(:group) { create(:group, :internal) }
+ let!(:subgroup) { create(:group, :internal, parent: group) }
+ let!(:project) { create(:project, :internal, group: group) }
+
+ describe "project" do
+ it "provides correct description for disabled levels" do
+ expect(disallowed_visibility_level?(project, Gitlab::VisibilityLevel::PUBLIC)).to be_truthy
+ expect(disallowed_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC, project))
+ .to include "the visibility of #{project.group.name} is internal"
+ end
+ end
+
+ describe "group" do
+ it "provides correct description for disabled levels" do
+ expect(disallowed_visibility_level?(group, Gitlab::VisibilityLevel::PRIVATE)).to be_truthy
+ expect(disallowed_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, group))
+ .to include "it contains projects with higher visibility", "it contains sub-groups with higher visibility"
+
+ expect(disallowed_visibility_level?(subgroup, Gitlab::VisibilityLevel::PUBLIC)).to be_truthy
+ expect(disallowed_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC, subgroup))
+ .to include "the visibility of its parent group is internal"
+ end
+ end
+ end
end