From 27c95364b52f4e93054c45211010aeb22e40a2b2 Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Fri, 22 Dec 2017 19:18:28 +1100 Subject: Replace '.team << [user, role]' with 'add_role(user)' in specs --- .../controllers/projects/issues_controller_spec.rb | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'spec/controllers/projects/issues_controller_spec.rb') diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index a2ef937609b..6b7db947216 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -37,7 +37,7 @@ describe Projects::IssuesController do context 'internal issue tracker' do before do sign_in(user) - project.team << [user, :developer] + project.add_developer(user) end it_behaves_like "issuables list meta-data", :issue @@ -69,7 +69,7 @@ describe Projects::IssuesController do before do sign_in(user) - project.team << [user, :developer] + project.add_developer(user) allow(Kaminari.config).to receive(:default_per_page).and_return(1) end @@ -116,7 +116,7 @@ describe Projects::IssuesController do context 'internal issue tracker' do before do sign_in(user) - project.team << [user, :developer] + project.add_developer(user) end it 'builds a new issue' do @@ -127,7 +127,7 @@ describe Projects::IssuesController do it 'fills in an issue for a merge request' do project_with_repository = create(:project, :repository) - project_with_repository.team << [user, :developer] + project_with_repository.add_developer(user) mr = create(:merge_request_with_diff_notes, source_project: project_with_repository) get :new, namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_to_resolve_discussions_of: mr.iid @@ -153,7 +153,7 @@ describe Projects::IssuesController do before do sign_in(user) - project.team << [user, :developer] + project.add_developer(user) external = double allow(project).to receive(:external_issue_tracker).and_return(external) @@ -329,7 +329,7 @@ describe Projects::IssuesController do it 'does not list confidential issues for project members with guest role' do sign_in(member) - project.team << [member, :guest] + project.add_guest(member) get_issues @@ -354,7 +354,7 @@ describe Projects::IssuesController do it 'lists confidential issues for project members' do sign_in(member) - project.team << [member, :developer] + project.add_developer(member) get_issues @@ -394,7 +394,7 @@ describe Projects::IssuesController do it 'returns 404 for project members with guest role' do sign_in(member) - project.team << [member, :guest] + project.add_guest(member) go(id: unescaped_parameter_value.to_param) expect(response).to have_gitlab_http_status :not_found @@ -416,7 +416,7 @@ describe Projects::IssuesController do it "returns #{http_status[:success]} for project members" do sign_in(member) - project.team << [member, :developer] + project.add_developer(member) go(id: unescaped_parameter_value.to_param) expect(response).to have_gitlab_http_status http_status[:success] @@ -450,7 +450,7 @@ describe Projects::IssuesController do before do sign_in(user) - project.team << [user, :developer] + project.add_developer(user) end it_behaves_like 'restricted action', success: 200 @@ -594,7 +594,7 @@ describe Projects::IssuesController do let(:deleted_user) { create(:user) } before do - project.team << [user, :developer] + project.add_developer(user) issue.update!(last_edited_by: deleted_user, last_edited_at: Time.now) @@ -638,7 +638,7 @@ describe Projects::IssuesController do def post_new_issue(issue_attrs = {}, additional_params = {}) sign_in(user) project = create(:project, :public) - project.team << [user, :developer] + project.add_developer(user) post :create, { namespace_id: project.namespace.to_param, @@ -655,7 +655,7 @@ describe Projects::IssuesController do let(:project) { merge_request.source_project } before do - project.team << [user, :master] + project.add_master(user) sign_in user end @@ -829,7 +829,7 @@ describe Projects::IssuesController do def post_spam admin = create(:admin) create(:user_agent_detail, subject: issue) - project.team << [admin, :master] + project.add_master(admin) sign_in(admin) post :mark_as_spam, { namespace_id: project.namespace, -- cgit v1.2.1