Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dccd53e1
Commit
dccd53e1
authored
Dec 09, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new tests for snippets_finder.rb
parent
a68735d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
spec/finders/snippets_finder_spec.rb
spec/finders/snippets_finder_spec.rb
+24
-1
No files found.
spec/finders/snippets_finder_spec.rb
View file @
dccd53e1
...
...
@@ -84,16 +84,39 @@ describe SnippetsFinder do
expect
(
snippets
).
not_to
include
(
@snippet1
,
@snippet2
)
end
it
"returns public and internal snippets for non
e
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment