Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
8e83ea2e1f96
Commit
8e83ea2e
authored
Jan 19, 2016
by
Josh Frye
Browse files
Add specs. Adjust filter.
parent
b56a559a4809
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
8e83ea2e
...
...
@@ -273,7 +273,7 @@
end
def
search_by_visibility
(
level
)
where
(
visibility_level:
v
isibility
_l
evel
s
[
level
.
capitalize
]
)
where
(
visibility_level:
Gitlab
::
V
isibility
L
evel
.
const_get
(
level
.
upcase
)
)
end
def
search_by_title
(
query
)
...
...
spec/requests/api/projects_spec.rb
View file @
8e83ea2e
...
...
@@ -90,6 +90,29 @@
end
end
context
'and using the visibility filter'
do
it
'should filter based on private visibility param'
do
get
api
(
'/projects'
,
user
),
{
visibility:
'private'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
user
.
namespace
.
projects
.
where
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
).
count
)
end
it
'should filter based on internal visibility param'
do
get
api
(
'/projects'
,
user
),
{
visibility:
'internal'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
user
.
namespace
.
projects
.
where
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
).
count
)
end
it
'should filter based on public visibility param'
do
get
api
(
'/projects'
,
user
),
{
visibility:
'public'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
user
.
namespace
.
projects
.
where
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
).
count
)
end
end
context
'and using sorting'
do
before
do
project2
...
...
Write
Preview
Supports
Markdown
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