Commit d364d7d0 authored by Sean McGivern's avatar Sean McGivern

Use `add_$role` helper in snippets specs

parent 8df474ea
......@@ -6,8 +6,8 @@ describe Projects::SnippetsController do
let(:user2) { create(:user) }
before do
project.team << [user, :master]
project.team << [user2, :master]
project.add_master(user)
project.add_master(user2)
end
describe 'GET #index' do
......@@ -73,7 +73,7 @@ describe Projects::SnippetsController do
def create_snippet(project, snippet_params = {})
sign_in(user)
project.team << [user, :developer]
project.add_developer(user)
post :create, {
namespace_id: project.namespace.to_param,
......@@ -133,7 +133,7 @@ describe Projects::SnippetsController do
def mark_as_spam
admin = create(:admin)
create(:user_agent_detail, subject: snippet)
project.team << [admin, :master]
project.add_master(admin)
sign_in(admin)
post :mark_as_spam,
......
......@@ -23,7 +23,7 @@ describe API::ProjectSnippets, api: true do
let(:user) { create(:user) }
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)
internal_snippet = create(:project_snippet, :internal, project: project)
private_snippet = create(:project_snippet, :private, project: project)
......@@ -76,7 +76,7 @@ describe API::ProjectSnippets, api: true do
context 'when the snippet is spam' do
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)
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