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
e0345c8d
Commit
e0345c8d
authored
Jul 05, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add snippets spec
parent
383138af
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
spec/requests/api/snippets_spec.rb
spec/requests/api/snippets_spec.rb
+21
-1
No files found.
spec/requests/api/snippets_spec.rb
View file @
e0345c8d
...
...
@@ -255,7 +255,6 @@ describe API::Snippets do
end
describe
'DELETE /snippets/:id'
do
let!
(
:public_snippet
)
{
create
(
:personal_snippet
,
:public
,
author:
user
)
}
it
'deletes snippet'
do
expect
do
delete
api
(
"/snippets/
#{
public_snippet
.
id
}
"
,
user
)
...
...
@@ -271,4 +270,25 @@ describe API::Snippets do
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Snippet Not Found'
)
end
end
describe
"GET /snippets/:id/user_agent_detail"
do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
author:
user
)
}
let!
(
:user_agent_detail
)
{
create
(
:user_agent_detail
,
subject:
snippet
)
}
it
'exposes known attributes'
do
get
api
(
"/snippets/
#{
snippet
.
id
}
/user_agent_detail"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
expect
(
json_response
[
'ip_address'
]).
to
eq
(
user_agent_detail
.
ip_address
)
expect
(
json_response
[
'submitted'
]).
to
be
false
end
it
"returns unautorized for non-admin users"
do
get
api
(
"/snippets/
#{
snippet
.
id
}
/user_agent_detail"
,
user
)
expect
(
response
).
to
have_http_status
(
403
)
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