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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
34918d94
Commit
34918d94
authored
Feb 02, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `add_$role` helper in snippets specs
parent
c63194ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
spec/controllers/projects/snippets_controller_spec.rb
spec/controllers/projects/snippets_controller_spec.rb
+4
-4
spec/requests/api/project_snippets_spec.rb
spec/requests/api/project_snippets_spec.rb
+2
-2
No files found.
spec/controllers/projects/snippets_controller_spec.rb
View file @
34918d94
...
@@ -6,8 +6,8 @@ describe Projects::SnippetsController do
...
@@ -6,8 +6,8 @@ describe Projects::SnippetsController do
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
project
.
team
<<
[
user2
,
:master
]
project
.
add_master
(
user2
)
end
end
describe
'GET #index'
do
describe
'GET #index'
do
...
@@ -73,7 +73,7 @@ describe Projects::SnippetsController do
...
@@ -73,7 +73,7 @@ describe Projects::SnippetsController do
def
create_snippet
(
project
,
snippet_params
=
{})
def
create_snippet
(
project
,
snippet_params
=
{})
sign_in
(
user
)
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
project
.
add_developer
(
user
)
post
:create
,
{
post
:create
,
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
...
@@ -133,7 +133,7 @@ describe Projects::SnippetsController do
...
@@ -133,7 +133,7 @@ describe Projects::SnippetsController do
def
mark_as_spam
def
mark_as_spam
admin
=
create
(
:admin
)
admin
=
create
(
:admin
)
create
(
:user_agent_detail
,
subject:
snippet
)
create
(
:user_agent_detail
,
subject:
snippet
)
project
.
team
<<
[
admin
,
:master
]
project
.
add_master
(
admin
)
sign_in
(
admin
)
sign_in
(
admin
)
post
:mark_as_spam
,
post
:mark_as_spam
,
...
...
spec/requests/api/project_snippets_spec.rb
View file @
34918d94
...
@@ -23,7 +23,7 @@ describe API::ProjectSnippets, api: true do
...
@@ -23,7 +23,7 @@ describe API::ProjectSnippets, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
it
'returns all snippets available to team member'
do
it
'returns all snippets available to team member'
do
project
.
team
<<
[
user
,
:developer
]
project
.
add_developer
(
user
)
public_snippet
=
create
(
:project_snippet
,
:public
,
project:
project
)
public_snippet
=
create
(
:project_snippet
,
:public
,
project:
project
)
internal_snippet
=
create
(
:project_snippet
,
:internal
,
project:
project
)
internal_snippet
=
create
(
:project_snippet
,
:internal
,
project:
project
)
private_snippet
=
create
(
:project_snippet
,
:private
,
project:
project
)
private_snippet
=
create
(
:project_snippet
,
:private
,
project:
project
)
...
@@ -76,7 +76,7 @@ describe API::ProjectSnippets, api: true do
...
@@ -76,7 +76,7 @@ describe API::ProjectSnippets, api: true do
context
'when the snippet is spam'
do
context
'when the snippet is spam'
do
def
create_snippet
(
project
,
snippet_params
=
{})
def
create_snippet
(
project
,
snippet_params
=
{})
project
.
team
<<
[
user
,
:developer
]
project
.
add_developer
(
user
)
post
api
(
"/projects/
#{
project
.
id
}
/snippets"
,
user
),
params
.
merge
(
snippet_params
)
post
api
(
"/projects/
#{
project
.
id
}
/snippets"
,
user
),
params
.
merge
(
snippet_params
)
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