From bebc526e3e37fffe45e7a1788e6e169fdfa6598b Mon Sep 17 00:00:00 2001 From: Jasper Maes <jaspermaes.jm@gmail.com> Date: Wed, 19 Dec 2018 22:57:41 +0100 Subject: [PATCH] Remove deprecated xhr from specs --- changelogs/unreleased/fix-55448.yml | 5 +++++ .../groups/group_members_controller_spec.rb | 10 ++++++---- .../projects/issues_controller_spec.rb | 4 ++-- .../projects/merge_requests_controller_spec.rb | 16 +++++++++------- .../project_members_controller_spec.rb | 18 +++++++++++------- .../projects/refs_controller_spec.rb | 14 +++++++------- 6 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 changelogs/unreleased/fix-55448.yml diff --git a/changelogs/unreleased/fix-55448.yml b/changelogs/unreleased/fix-55448.yml new file mode 100644 index 00000000000..e0bdbb6eda4 --- /dev/null +++ b/changelogs/unreleased/fix-55448.yml @@ -0,0 +1,5 @@ +--- +title: Remove deprecated xhr from specs +merge_request: 23949 +author: Jasper Maes +type: other diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb index 00a00306ff9..ed38dadfd6b 100644 --- a/spec/controllers/groups/group_members_controller_spec.rb +++ b/spec/controllers/groups/group_members_controller_spec.rb @@ -78,9 +78,11 @@ describe Groups::GroupMembersController do Gitlab::Access.options.each do |label, value| it "can change the access level to #{label}" do - xhr :put, :update, group_member: { access_level: value }, - group_id: group, - id: requester + put :update, params: { + group_member: { access_level: value }, + group_id: group, + id: requester + }, xhr: true expect(requester.reload.human_access).to eq(label) end @@ -130,7 +132,7 @@ describe Groups::GroupMembersController do end it '[JS] removes user from members' do - xhr :delete, :destroy, group_id: group, id: member + delete :destroy, params: { group_id: group, id: member }, xhr: true expect(response).to be_success expect(group.members).not_to include member diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index f9193513a6a..a239ac16c0d 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -206,12 +206,12 @@ describe Projects::IssuesController do describe 'Redirect after sign in' do context 'with an AJAX request' do it 'does not store the visited URL' do - xhr :get, - :show, + get :show, params: { format: :json, namespace_id: project.namespace, project_id: project, id: issue.iid + }, xhr: true expect(session['user_return_to']).to be_blank end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 962dfb91c9f..1ab227bde39 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -333,7 +333,7 @@ describe Projects::MergeRequestsController do before do project.add_reporter(user) - xhr :post, :merge, params: base_params + post :merge, params: base_params, xhr: true end it 'returns 404' do @@ -681,13 +681,14 @@ describe Projects::MergeRequestsController do merge_request.title = merge_request.wip_title merge_request.save - xhr :post, :remove_wip, - format: :json, + post :remove_wip, params: { + format: :json, namespace_id: merge_request.project.namespace.to_param, project_id: merge_request.project, id: merge_request.iid - } + }, + xhr: true end it 'removes the wip status' do @@ -701,13 +702,14 @@ describe Projects::MergeRequestsController do describe 'POST cancel_merge_when_pipeline_succeeds' do subject do - xhr :post, :cancel_merge_when_pipeline_succeeds, - format: :json, + post :cancel_merge_when_pipeline_succeeds, params: { + format: :json, namespace_id: merge_request.project.namespace.to_param, project_id: merge_request.project, id: merge_request.iid - } + }, + xhr: true end it 'calls MergeRequests::MergeWhenPipelineSucceedsService' do diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb index 009f85903b5..3cc3fe69fba 100644 --- a/spec/controllers/projects/project_members_controller_spec.rb +++ b/spec/controllers/projects/project_members_controller_spec.rb @@ -82,10 +82,12 @@ describe Projects::ProjectMembersController do Gitlab::Access.options.each do |label, value| it "can change the access level to #{label}" do - xhr :put, :update, project_member: { access_level: value }, - namespace_id: project.namespace, - project_id: project, - id: requester + put :update, params: { + project_member: { access_level: value }, + namespace_id: project.namespace, + project_id: project, + id: requester + }, xhr: true expect(requester.reload.human_access).to eq(label) end @@ -148,9 +150,11 @@ describe Projects::ProjectMembersController do end it '[JS] removes user from members' do - xhr :delete, :destroy, namespace_id: project.namespace, - project_id: project, - id: member + delete :destroy, params: { + namespace_id: project.namespace, + project_id: project, + id: member + }, xhr: true expect(response).to be_success expect(project.members).not_to include member diff --git a/spec/controllers/projects/refs_controller_spec.rb b/spec/controllers/projects/refs_controller_spec.rb index ea299e1e8c5..62f2af947e4 100644 --- a/spec/controllers/projects/refs_controller_spec.rb +++ b/spec/controllers/projects/refs_controller_spec.rb @@ -22,13 +22,13 @@ describe Projects::RefsController do end def xhr_get(format = :html) - xhr :get, - :logs_tree, - namespace_id: project.namespace.to_param, - project_id: project, - id: 'master', - path: 'foo/bar/baz.html', - format: format + get :logs_tree, params: { + namespace_id: project.namespace.to_param, + project_id: project, + id: 'master', + path: 'foo/bar/baz.html', + format: format + }, xhr: true end it 'never throws MissingTemplate' do -- 2.30.9