diff options
author | Sean McGivern <sean@gitlab.com> | 2017-02-02 13:10:42 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-02-02 14:03:08 +0000 |
commit | 34918d94c011e8f81bd962d43d67fe8bd9f21e3e (patch) | |
tree | 55c41f8f008268fd21e2e53441330c3f41a7ff3b | |
parent | c63194ce6f952173649d7de4038aa96348e90565 (diff) | |
download | gitlab-ce-34918d94c011e8f81bd962d43d67fe8bd9f21e3e.tar.gz |
Use `add_$role` helper in snippets specssnippet-spam
-rw-r--r-- | spec/controllers/projects/snippets_controller_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/project_snippets_spec.rb | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb index 88e4f81f232..19e948d8fb8 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -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, diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb index 9e25e30bc86..45d5ae267c5 100644 --- a/spec/requests/api/project_snippets_spec.rb +++ b/spec/requests/api/project_snippets_spec.rb @@ -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 |