diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-12-09 16:01:08 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2016-12-10 00:57:23 -0600 |
commit | dccd53e1ce1903f2df8dd20023e2bafd96d850f3 (patch) | |
tree | f3c83d2c6596785ff05dbe3abc6d9235fd452dd7 /spec/finders/snippets_finder_spec.rb | |
parent | a68735d4985bf5ffaeaf5a051b40f8aed0c0a6e0 (diff) | |
download | gitlab-ce-dccd53e1ce1903f2df8dd20023e2bafd96d850f3.tar.gz |
add new tests for snippets_finder.rb
Diffstat (limited to 'spec/finders/snippets_finder_spec.rb')
-rw-r--r-- | spec/finders/snippets_finder_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/finders/snippets_finder_spec.rb b/spec/finders/snippets_finder_spec.rb index 28bdc18e840..21ccdaa6c38 100644 --- a/spec/finders/snippets_finder_spec.rb +++ b/spec/finders/snippets_finder_spec.rb @@ -84,16 +84,39 @@ describe SnippetsFinder do expect(snippets).not_to include(@snippet1, @snippet2) end - it "returns public and internal snippets for none project members" do + it "returns public and internal snippets for non project members" do snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1) expect(snippets).to include(@snippet2, @snippet3) expect(snippets).not_to include(@snippet1) end + it "returns public snippets for non project members" do + snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1, scope: "are_public") + expect(snippets).to include(@snippet3) + expect(snippets).not_to include(@snippet1, @snippet2) + end + + it "returns internal snippets for non project members" do + snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1, scope: "are_internal") + expect(snippets).to include(@snippet2) + expect(snippets).not_to include(@snippet1, @snippet3) + end + + it "does not return private snippets for non project members" do + snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1, scope: "are_private") + expect(snippets).not_to include(@snippet1, @snippet2, @snippet3) + end + it "returns all snippets for project members" do project1.team << [user, :developer] snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1) expect(snippets).to include(@snippet1, @snippet2, @snippet3) end + + it "returns private snippets for project members" do + project1.team << [user, :developer] + snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1, scope: "are_private") + expect(snippets).to include(@snippet1) + end end end |