Commit 34918d94 authored by Sean McGivern's avatar Sean McGivern

Use `add_$role` helper in snippets specs

parent c63194ce
...@@ -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,
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment