diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-07-06 15:38:43 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-07-06 17:40:33 +0300 |
commit | 111ebe54712aca16f3ad0f3d859c1c036ccb9f09 (patch) | |
tree | 058564d9186c5bd291da7753cf8ee9d0c01f8c1e /spec/helpers/visibility_level_helper_spec.rb | |
parent | 17446ff0c98e870f0500279983432e5115e060a4 (diff) |
Fork visibility level fix
Diffstat (limited to 'spec/helpers/visibility_level_helper_spec.rb')
-rw-r--r-- | spec/helpers/visibility_level_helper_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb index 3840e64981f..c4f7693329c 100644 --- a/spec/helpers/visibility_level_helper_spec.rb +++ b/spec/helpers/visibility_level_helper_spec.rb @@ -72,4 +72,43 @@ describe VisibilityLevelHelper do end end end + + describe "skip_level?" do + describe "forks" do + let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } + let(:fork_project) { create(:forked_project_with_submodules) } + + before do + fork_project.build_forked_project_link(forked_to_project_id: fork_project.id, forked_from_project_id: project.id) + fork_project.save + end + + it "skips levels" do + expect(skip_level?(fork_project, Gitlab::VisibilityLevel::PUBLIC)).to be_truthy + expect(skip_level?(fork_project, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(skip_level?(fork_project, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + describe "non-forked project" do + let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } + + it "skips levels" do + expect(skip_level?(project, Gitlab::VisibilityLevel::PUBLIC)).to be_falsey + expect(skip_level?(project, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(skip_level?(project, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + describe "Snippet" do + let(:snippet) { create(:snippet, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } + + it "skips levels" do + expect(skip_level?(snippet, Gitlab::VisibilityLevel::PUBLIC)).to be_falsey + expect(skip_level?(snippet, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(skip_level?(snippet, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + end end |