diff options
author | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-12-19 22:50:20 +0300 |
---|---|---|
committer | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-12-21 12:10:26 +0300 |
commit | bf7352007920318ea361674a02fbff6823bbe5a8 (patch) | |
tree | c4c64947bb66cfbe2f15d59946b4bf2695e6418f /spec | |
parent | f1464680c15c96d3dcc6f61aa3a8d77b72f4d098 (diff) |
convert specs in javascripts/ and support/ to new syntax
Diffstat (limited to 'spec')
36 files changed, 160 insertions, 158 deletions
diff --git a/spec/controllers/projects/tags/releases_controller_spec.rb b/spec/controllers/projects/tags/releases_controller_spec.rb index 6bf4ac65a45..29f206c574b 100644 --- a/spec/controllers/projects/tags/releases_controller_spec.rb +++ b/spec/controllers/projects/tags/releases_controller_spec.rb @@ -18,7 +18,7 @@ describe Projects::Tags::ReleasesController do tag_id = release.tag project.releases.destroy_all # rubocop: disable DestroyAll - get :edit, namespace_id: project.namespace, project_id: project, tag_id: tag_id + get :edit, params: { namespace_id: project.namespace, project_id: project, tag_id: tag_id } release = assigns(:release) expect(release).not_to be_nil @@ -26,7 +26,7 @@ describe Projects::Tags::ReleasesController do end it 'retrieves an existing release' do - get :edit, namespace_id: project.namespace, project_id: project, tag_id: release.tag + get :edit, params: { namespace_id: project.namespace, project_id: project, tag_id: release.tag } release = assigns(:release) expect(release).not_to be_nil @@ -48,10 +48,11 @@ describe Projects::Tags::ReleasesController do end def update_release(description) - put :update, + put :update, params: { namespace_id: project.namespace.to_param, project_id: project, tag_id: release.tag, release: { description: description } + } end end diff --git a/spec/javascripts/fixtures/blob.rb b/spec/javascripts/fixtures/blob.rb index 81e8a51a902..1b2a3b484bb 100644 --- a/spec/javascripts/fixtures/blob.rb +++ b/spec/javascripts/fixtures/blob.rb @@ -22,10 +22,11 @@ describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do end it 'blob/show.html.raw' do |example| - get(:show, - namespace_id: project.namespace, - project_id: project, - id: 'add-ipython-files/files/ipython/basic.ipynb') + get(:show, params: { + namespace_id: project.namespace, + project_id: project, + id: 'add-ipython-files/files/ipython/basic.ipynb' + }) expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/boards.rb b/spec/javascripts/fixtures/boards.rb index 494c9cabdcc..1d675e008ba 100644 --- a/spec/javascripts/fixtures/boards.rb +++ b/spec/javascripts/fixtures/boards.rb @@ -18,9 +18,10 @@ describe Projects::BoardsController, '(JavaScript fixtures)', type: :controller end it 'boards/show.html.raw' do |example| - get(:index, - namespace_id: project.namespace, - project_id: project) + get(:index, params: { + namespace_id: project.namespace, + project_id: project + }) expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/branches.rb b/spec/javascripts/fixtures/branches.rb index 4fc072d2585..3cc713ef90f 100644 --- a/spec/javascripts/fixtures/branches.rb +++ b/spec/javascripts/fixtures/branches.rb @@ -22,9 +22,10 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle end it 'branches/new_branch.html.raw' do |example| - get :new, + get :new, params: { namespace_id: project.namespace.to_param, project_id: project + } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/clusters.rb b/spec/javascripts/fixtures/clusters.rb index 8e74c4f859c..69dbe54ffc2 100644 --- a/spec/javascripts/fixtures/clusters.rb +++ b/spec/javascripts/fixtures/clusters.rb @@ -23,10 +23,11 @@ describe Projects::ClustersController, '(JavaScript fixtures)', type: :controlle end it 'clusters/show_cluster.html.raw' do |example| - get :show, + get :show, params: { namespace_id: project.namespace.to_param, project_id: project, id: cluster + } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/commit.rb b/spec/javascripts/fixtures/commit.rb index 24ab8159a18..f0e4bb50c67 100644 --- a/spec/javascripts/fixtures/commit.rb +++ b/spec/javascripts/fixtures/commit.rb @@ -25,7 +25,7 @@ describe Projects::CommitController, '(JavaScript fixtures)', type: :controller id: commit.id } - get :show, params + get :show, params: params expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/deploy_keys.rb b/spec/javascripts/fixtures/deploy_keys.rb index 24699c3043a..efbda955972 100644 --- a/spec/javascripts/fixtures/deploy_keys.rb +++ b/spec/javascripts/fixtures/deploy_keys.rb @@ -33,10 +33,10 @@ describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :control create(:deploy_keys_project, project: project3, deploy_key: project_key) create(:deploy_keys_project, project: project4, deploy_key: project_key) - get :index, + get :index, params: { namespace_id: project.namespace.to_param, - project_id: project, - format: :json + project_id: project + }, format: :json expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/groups.rb b/spec/javascripts/fixtures/groups.rb index b42f442557c..f8d55fc97c3 100644 --- a/spec/javascripts/fixtures/groups.rb +++ b/spec/javascripts/fixtures/groups.rb @@ -19,8 +19,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do describe GroupsController, '(JavaScript fixtures)', type: :controller do it 'groups/edit.html.raw' do |example| - get :edit, - id: group + get :edit, params: { id: group } expect(response).to be_success store_frontend_fixture(response, example.description) @@ -29,8 +28,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do describe Groups::Settings::CiCdController, '(JavaScript fixtures)', type: :controller do it 'groups/ci_cd_settings.html.raw' do |example| - get :show, - group_id: group + get :show, params: { group_id: group } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/issues.rb b/spec/javascripts/fixtures/issues.rb index 0ee2f82dfd6..18fb1bebf8b 100644 --- a/spec/javascripts/fixtures/issues.rb +++ b/spec/javascripts/fixtures/issues.rb @@ -43,9 +43,10 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller it 'issues/issue_list.html.raw' do |example| create(:issue, project: project) - get :index, + get :index, params: { namespace_id: project.namespace.to_param, project_id: project + } expect(response).to be_success store_frontend_fixture(response, example.description) @@ -54,10 +55,11 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller private def render_issue(fixture_file_name, issue) - get :show, + get :show, params: { namespace_id: project.namespace.to_param, project_id: project, id: issue.to_param + } expect(response).to be_success store_frontend_fixture(response, fixture_file_name) diff --git a/spec/javascripts/fixtures/jobs.rb b/spec/javascripts/fixtures/jobs.rb index 82d7a5e394e..d6b5349594d 100644 --- a/spec/javascripts/fixtures/jobs.rb +++ b/spec/javascripts/fixtures/jobs.rb @@ -34,21 +34,22 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do end it 'builds/build-with-artifacts.html.raw' do |example| - get :show, + get :show, params: { namespace_id: project.namespace.to_param, project_id: project, id: build_with_artifacts.to_param + } expect(response).to be_success store_frontend_fixture(response, example.description) end it 'jobs/delayed.json' do |example| - get :show, - namespace_id: project.namespace.to_param, - project_id: project, - id: delayed_job.to_param, - format: :json + get :show, params: { + namespace_id: project.namespace.to_param, + project_id: project, + id: delayed_job.to_param + }, format: :json expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/labels.rb b/spec/javascripts/fixtures/labels.rb index b730d557e21..9420194e675 100644 --- a/spec/javascripts/fixtures/labels.rb +++ b/spec/javascripts/fixtures/labels.rb @@ -31,9 +31,9 @@ describe 'Labels (JavaScript fixtures)' do end it 'labels/group_labels.json' do |example| - get :index, - group_id: group, - format: 'json' + get :index, params: { + group_id: group + }, format: 'json' expect(response).to be_success store_frontend_fixture(response, example.description) @@ -48,10 +48,10 @@ describe 'Labels (JavaScript fixtures)' do end it 'labels/project_labels.json' do |example| - get :index, + get :index, params: { namespace_id: group, - project_id: project, - format: 'json' + project_id: project + }, format: 'json' expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/merge_requests.rb b/spec/javascripts/fixtures/merge_requests.rb index 7257d0c8556..26e81f06c0b 100644 --- a/spec/javascripts/fixtures/merge_requests.rb +++ b/spec/javascripts/fixtures/merge_requests.rb @@ -112,21 +112,21 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont private def render_discussions_json(merge_request, fixture_file_name) - get :discussions, + get :discussions, params: { namespace_id: project.namespace.to_param, project_id: project, - id: merge_request.to_param, - format: :json + id: merge_request.to_param + }, format: :json store_frontend_fixture(response, fixture_file_name) end def render_merge_request(fixture_file_name, merge_request) - get :show, + get :show, params: { namespace_id: project.namespace.to_param, project_id: project, - id: merge_request.to_param, - format: :html + id: merge_request.to_param + }, format: :html expect(response).to be_success store_frontend_fixture(response, fixture_file_name) diff --git a/spec/javascripts/fixtures/merge_requests_diffs.rb b/spec/javascripts/fixtures/merge_requests_diffs.rb index afe34b834b0..57462e74bb2 100644 --- a/spec/javascripts/fixtures/merge_requests_diffs.rb +++ b/spec/javascripts/fixtures/merge_requests_diffs.rb @@ -57,13 +57,13 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type private def render_merge_request(fixture_file_name, merge_request, view: 'inline', **extra_params) - get :show, + get :show, params: { namespace_id: project.namespace.to_param, project_id: project, id: merge_request.to_param, - format: :json, view: view, **extra_params + }, format: :json expect(response).to be_success store_frontend_fixture(response, fixture_file_name) diff --git a/spec/javascripts/fixtures/pipeline_schedules.rb b/spec/javascripts/fixtures/pipeline_schedules.rb index 56f27ea7df1..05d79ec8de9 100644 --- a/spec/javascripts/fixtures/pipeline_schedules.rb +++ b/spec/javascripts/fixtures/pipeline_schedules.rb @@ -22,20 +22,22 @@ describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', type: : end it 'pipeline_schedules/edit.html.raw' do |example| - get :edit, + get :edit, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id + } expect(response).to be_success store_frontend_fixture(response, example.description) end it 'pipeline_schedules/edit_with_variables.html.raw' do |example| - get :edit, + get :edit, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule_populated.id + } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/pipelines.rb b/spec/javascripts/fixtures/pipelines.rb index bb85da50f0f..42b552e81c0 100644 --- a/spec/javascripts/fixtures/pipelines.rb +++ b/spec/javascripts/fixtures/pipelines.rb @@ -24,10 +24,10 @@ describe Projects::PipelinesController, '(JavaScript fixtures)', type: :controll end it 'pipelines/pipelines.json' do |example| - get :index, + get :index, params: { namespace_id: namespace, - project_id: project, - format: :json + project_id: project + }, format: :json expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/projects.rb b/spec/javascripts/fixtures/projects.rb index d98f7f55b20..9b48646f8f0 100644 --- a/spec/javascripts/fixtures/projects.rb +++ b/spec/javascripts/fixtures/projects.rb @@ -28,27 +28,30 @@ describe 'Projects (JavaScript fixtures)', type: :controller do describe ProjectsController, '(JavaScript fixtures)', type: :controller do it 'projects/dashboard.html.raw' do |example| - get :show, + get :show, params: { namespace_id: project.namespace.to_param, id: project + } expect(response).to be_success store_frontend_fixture(response, example.description) end it 'projects/overview.html.raw' do |example| - get :show, + get :show, params: { namespace_id: project_with_repo.namespace.to_param, id: project_with_repo + } expect(response).to be_success store_frontend_fixture(response, example.description) end it 'projects/edit.html.raw' do |example| - get :edit, + get :edit, params: { namespace_id: project.namespace.to_param, id: project + } expect(response).to be_success store_frontend_fixture(response, example.description) @@ -57,18 +60,20 @@ describe 'Projects (JavaScript fixtures)', type: :controller do describe Projects::Settings::CiCdController, '(JavaScript fixtures)', type: :controller do it 'projects/ci_cd_settings.html.raw' do |example| - get :show, + get :show, params: { namespace_id: project.namespace.to_param, project_id: project + } expect(response).to be_success store_frontend_fixture(response, example.description) end it 'projects/ci_cd_settings_with_variables.html.raw' do |example| - get :show, + get :show, params: { namespace_id: project_variable_populated.namespace.to_param, project_id: project_variable_populated + } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/prometheus_service.rb b/spec/javascripts/fixtures/prometheus_service.rb index f95f8038ffb..746fbfd66dd 100644 --- a/spec/javascripts/fixtures/prometheus_service.rb +++ b/spec/javascripts/fixtures/prometheus_service.rb @@ -23,10 +23,11 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle end it 'services/prometheus/prometheus_service.html.raw' do |example| - get :edit, + get :edit, params: { namespace_id: namespace, project_id: project, id: service.to_param + } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/services.rb b/spec/javascripts/fixtures/services.rb index 9280ed5a7f1..6ccd74a07ff 100644 --- a/spec/javascripts/fixtures/services.rb +++ b/spec/javascripts/fixtures/services.rb @@ -23,10 +23,11 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle end it 'services/edit_service.html.raw' do |example| - get :edit, + get :edit, params: { namespace_id: namespace, project_id: project, id: service.to_param + } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/snippet.rb b/spec/javascripts/fixtures/snippet.rb index 38fc963caf7..a14837e4d4a 100644 --- a/spec/javascripts/fixtures/snippet.rb +++ b/spec/javascripts/fixtures/snippet.rb @@ -24,7 +24,7 @@ describe SnippetsController, '(JavaScript fixtures)', type: :controller do end it 'snippets/show.html.raw' do |example| - get(:show, id: snippet.to_param) + get(:show, params: { id: snippet.to_param }) expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/todos.rb b/spec/javascripts/fixtures/todos.rb index 426b854fe8b..b5f6620873b 100644 --- a/spec/javascripts/fixtures/todos.rb +++ b/spec/javascripts/fixtures/todos.rb @@ -42,12 +42,12 @@ describe 'Todos (JavaScript fixtures)' do end it 'todos/todos.json' do |example| - post :create, + post :create, params: { namespace_id: namespace, project_id: project, issuable_type: 'issue', - issuable_id: issue_2.id, - format: 'json' + issuable_id: issue_2.id + }, format: 'json' expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/u2f.rb b/spec/javascripts/fixtures/u2f.rb index e3d7986f2cf..f0aa874bf75 100644 --- a/spec/javascripts/fixtures/u2f.rb +++ b/spec/javascripts/fixtures/u2f.rb @@ -21,7 +21,7 @@ context 'U2F' do it 'u2f/authenticate.html.raw' do |example| allow(controller).to receive(:find_user).and_return(user) - post :create, user: { login: user.username, password: user.password } + post :create, params: { user: { login: user.username, password: user.password } } expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/requests/api/events_spec.rb b/spec/requests/api/events_spec.rb index 8c58ba45ce9..0ac23505de7 100644 --- a/spec/requests/api/events_spec.rb +++ b/spec/requests/api/events_spec.rb @@ -226,7 +226,7 @@ describe API::Events do end it 'correctly returns the second page without inaccessible events' do - get api("/projects/#{public_project.id}/events", user), per_page: 2, page: 2 + get api("/projects/#{public_project.id}/events", user), params: { per_page: 2, page: 2 } titles = json_response.map { |event| event['target_title'] } @@ -235,7 +235,7 @@ describe API::Events do end it 'correctly returns the first page without inaccessible events' do - get api("/projects/#{public_project.id}/events", user), per_page: 2, page: 1 + get api("/projects/#{public_project.id}/events", user), params: { per_page: 2, page: 1 } titles = json_response.map { |event| event['target_title'] } diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index e6d82448c0d..0ba1f2d7a2b 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -54,7 +54,7 @@ describe API::Files do describe "HEAD /projects/:id/repository/files/:file_path" do shared_examples_for 'repository files' do it 'returns file attributes in headers' do - head api(route(file_path), current_user), params + head api(route(file_path), current_user), params: params expect(response).to have_gitlab_http_status(200) expect(response.headers['X-Gitlab-File-Path']).to eq(CGI.unescape(file_path)) @@ -68,7 +68,7 @@ describe API::Files do file_path = "files%2Fjs%2Fcommit%2Ejs%2Ecoffee" params[:ref] = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9" - head api(route(file_path), current_user), params + head api(route(file_path), current_user), params: params expect(response).to have_gitlab_http_status(200) expect(response.headers['X-Gitlab-File-Name']).to eq('commit.js.coffee') @@ -87,7 +87,7 @@ describe API::Files do it "responds with a 404 status" do params[:ref] = 'master' - head api(route('app%2Fmodels%2Fapplication%2Erb'), current_user), params + head api(route('app%2Fmodels%2Fapplication%2Erb'), current_user), params: params expect(response).to have_gitlab_http_status(404) end @@ -97,7 +97,7 @@ describe API::Files do include_context 'disabled repository' it "responds with a 403 status" do - head api(route(file_path), current_user), params + head api(route(file_path), current_user), params: params expect(response).to have_gitlab_http_status(403) end @@ -115,7 +115,7 @@ describe API::Files do it "responds with a 404 status" do current_user = nil - head api(route(file_path), current_user), params + head api(route(file_path), current_user), params: params expect(response).to have_gitlab_http_status(404) end @@ -136,7 +136,7 @@ describe API::Files do context 'when authenticated', 'as a guest' do it_behaves_like '403 response' do - let(:request) { head api(route(file_path), guest), params } + let(:request) { head api(route(file_path), guest), params: params } end end end diff --git a/spec/support/api/boards_shared_examples.rb b/spec/support/api/boards_shared_examples.rb index 943c1f6ffd7..592962ebf7c 100644 --- a/spec/support/api/boards_shared_examples.rb +++ b/spec/support/api/boards_shared_examples.rb @@ -88,7 +88,7 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false| let(:url) { "#{root_url}/#{board.id}/lists" } it 'creates a new issue board list for labels' do - post api(url, user), label_id: ux_label.id + post api(url, user), params: { label_id: ux_label.id } expect(response).to have_gitlab_http_status(201) expect(json_response['label']['name']).to eq(ux_label.title) @@ -96,13 +96,13 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false| end it 'returns 400 when creating a new list if label_id is invalid' do - post api(url, user), label_id: 23423 + post api(url, user), params: { label_id: 23423 } expect(response).to have_gitlab_http_status(400) end it 'returns 403 for members with guest role' do - put api("#{url}/#{test_list.id}", guest), position: 1 + put api("#{url}/#{test_list.id}", guest), params: { position: 1 } expect(response).to have_gitlab_http_status(403) end @@ -112,23 +112,20 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false| let(:url) { "#{root_url}/#{board.id}/lists" } it "updates a list" do - put api("#{url}/#{test_list.id}", user), - position: 1 + put api("#{url}/#{test_list.id}", user), params: { position: 1 } expect(response).to have_gitlab_http_status(200) expect(json_response['position']).to eq(1) end it "returns 404 error if list id not found" do - put api("#{url}/44444", user), - position: 1 + put api("#{url}/44444", user), params: { position: 1 } expect(response).to have_gitlab_http_status(404) end it "returns 403 for members with guest role" do - put api("#{url}/#{test_list.id}", guest), - position: 1 + put api("#{url}/#{test_list.id}", guest), params: { position: 1 } expect(response).to have_gitlab_http_status(403) end diff --git a/spec/support/api/milestones_shared_examples.rb b/spec/support/api/milestones_shared_examples.rb index 3bebb7aae90..5f709831ce1 100644 --- a/spec/support/api/milestones_shared_examples.rb +++ b/spec/support/api/milestones_shared_examples.rb @@ -45,7 +45,7 @@ shared_examples_for 'group and project milestones' do |route_definition| it 'returns an array of milestones specified by iids' do other_milestone = create(:milestone, project: try(:project), group: try(:group)) - get api(route, user), iids: [closed_milestone.iid, other_milestone.iid] + get api(route, user), params: { iids: [closed_milestone.iid, other_milestone.iid] } expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array @@ -54,7 +54,7 @@ shared_examples_for 'group and project milestones' do |route_definition| end it 'does not return any milestone if none found' do - get api(route, user), iids: [Milestone.maximum(:iid).succ] + get api(route, user), params: { iids: [Milestone.maximum(:iid).succ] } expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array @@ -73,7 +73,7 @@ shared_examples_for 'group and project milestones' do |route_definition| end it 'returns a milestone by searching for title' do - get api(route, user), search: 'version2' + get api(route, user), params: { search: 'version2' } expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers @@ -83,7 +83,7 @@ shared_examples_for 'group and project milestones' do |route_definition| end it 'returns a milestones by searching for description' do - get api(route, user), search: 'open' + get api(route, user), params: { search: 'open' } expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers @@ -117,7 +117,7 @@ shared_examples_for 'group and project milestones' do |route_definition| describe "POST #{route_definition}" do it 'creates a new milestone' do - post api(route, user), title: 'new milestone' + post api(route, user), params: { title: 'new milestone' } expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('new milestone') @@ -125,8 +125,7 @@ shared_examples_for 'group and project milestones' do |route_definition| end it 'creates a new milestone with description and dates' do - post api(route, user), - title: 'new milestone', description: 'release', due_date: '2013-03-02', start_date: '2013-02-02' + post api(route, user), params: { title: 'new milestone', description: 'release', due_date: '2013-03-02', start_date: '2013-02-02' } expect(response).to have_gitlab_http_status(201) expect(json_response['description']).to eq('release') @@ -141,14 +140,13 @@ shared_examples_for 'group and project milestones' do |route_definition| end it 'returns a 400 error if params are invalid (duplicate title)' do - post api(route, user), - title: milestone.title, description: 'release', due_date: '2013-03-02' + post api(route, user), params: { title: milestone.title, description: 'release', due_date: '2013-03-02' } expect(response).to have_gitlab_http_status(400) end it 'creates a new milestone with reserved html characters' do - post api(route, user), title: 'foo & bar 1.1 -> 2.2' + post api(route, user), params: { title: 'foo & bar 1.1 -> 2.2' } expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('foo & bar 1.1 -> 2.2') @@ -158,8 +156,7 @@ shared_examples_for 'group and project milestones' do |route_definition| describe "PUT #{route_definition}/:milestone_id" do it 'updates a milestone' do - put api(resource_route, user), - title: 'updated title' + put api(resource_route, user), params: { title: 'updated title' } expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq('updated title') @@ -168,29 +165,27 @@ shared_examples_for 'group and project milestones' do |route_definition| it 'removes a due date if nil is passed' do milestone.update!(due_date: "2016-08-05") - put api(resource_route, user), due_date: nil + put api(resource_route, user), params: { due_date: nil } expect(response).to have_gitlab_http_status(200) expect(json_response['due_date']).to be_nil end it 'returns a 404 error if milestone id not found' do - put api("#{route}/1234", user), - title: 'updated title' + put api("#{route}/1234", user), params: { title: 'updated title' } expect(response).to have_gitlab_http_status(404) end it 'closes milestone' do - put api(resource_route, user), - state_event: 'close' + put api(resource_route, user), params: { state_event: 'close' } expect(response).to have_gitlab_http_status(200) expect(json_response['state']).to eq('closed') end it 'updates milestone with only start date' do - put api(resource_route, user), start_date: Date.tomorrow + put api(resource_route, user), params: { start_date: Date.tomorrow } expect(response).to have_gitlab_http_status(200) end diff --git a/spec/support/api/scopes/read_user_shared_examples.rb b/spec/support/api/scopes/read_user_shared_examples.rb index d7cef137989..683234264a8 100644 --- a/spec/support/api/scopes/read_user_shared_examples.rb +++ b/spec/support/api/scopes/read_user_shared_examples.rb @@ -77,7 +77,7 @@ shared_examples_for 'does not allow the "read_user" scope' do let(:token) { create(:personal_access_token, scopes: ['read_user'], user: user) } it 'returns a "403" response' do - post api_call.call(path, user, personal_access_token: token), attributes_for(:user, projects_limit: 3) + post api_call.call(path, user, personal_access_token: token), params: attributes_for(:user, projects_limit: 3) expect(response).to have_gitlab_http_status(403) end diff --git a/spec/support/api/time_tracking_shared_examples.rb b/spec/support/api/time_tracking_shared_examples.rb index fee464c15a3..e883d33f671 100644 --- a/spec/support/api/time_tracking_shared_examples.rb +++ b/spec/support/api/time_tracking_shared_examples.rb @@ -7,13 +7,13 @@ shared_examples 'time tracking endpoints' do |issuable_name| describe "POST /projects/:id/#{issuable_collection_name}/:#{issuable_name}_id/time_estimate" do context 'with an unauthorized user' do - subject { post(api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", non_member), duration: '1w') } + subject { post(api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", non_member), params: { duration: '1w' }) } it_behaves_like 'an unauthorized API user' end it "sets the time estimate for #{issuable_name}" do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), duration: '1w' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), params: { duration: '1w' } expect(response).to have_gitlab_http_status(200) expect(json_response['human_time_estimate']).to eq('1w') @@ -21,12 +21,12 @@ shared_examples 'time tracking endpoints' do |issuable_name| describe 'updating the current estimate' do before do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), duration: '1w' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), params: { duration: '1w' } end context 'when duration has a bad format' do it 'does not modify the original estimate' do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), duration: 'foo' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), params: { duration: 'foo' } expect(response).to have_gitlab_http_status(400) expect(issuable.reload.human_time_estimate).to eq('1w') @@ -35,7 +35,7 @@ shared_examples 'time tracking endpoints' do |issuable_name| context 'with a valid duration' do it 'updates the estimate' do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), duration: '3w1h' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/time_estimate", user), params: { duration: '3w1h' } expect(response).to have_gitlab_http_status(200) expect(issuable.reload.human_time_estimate).to eq('3w 1h') @@ -62,8 +62,7 @@ shared_examples 'time tracking endpoints' do |issuable_name| describe "POST /projects/:id/#{issuable_collection_name}/:#{issuable_name}_id/add_spent_time" do context 'with an unauthorized user' do subject do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", non_member), - duration: '2h' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", non_member), params: { duration: '2h' } end it_behaves_like 'an unauthorized API user' @@ -72,8 +71,7 @@ shared_examples 'time tracking endpoints' do |issuable_name| it "add spent time for #{issuable_name}" do Timecop.travel(1.minute.from_now) do expect do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), - duration: '2h' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), params: { duration: '2h' } end.to change { issuable.reload.updated_at } end @@ -89,8 +87,7 @@ shared_examples 'time tracking endpoints' do |issuable_name| end.to change { issuable.reload.updated_at } end - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), - duration: '-1h' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), params: { duration: '-1h' } expect(response).to have_gitlab_http_status(201) expect(json_response['total_time_spent']).to eq(3600) @@ -103,8 +100,7 @@ shared_examples 'time tracking endpoints' do |issuable_name| Timecop.travel(1.minute.from_now) do expect do - post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), - duration: '-1w' + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), params: { duration: '-1w' } end.not_to change { issuable.reload.updated_at } end diff --git a/spec/support/controllers/githubish_import_controller_shared_examples.rb b/spec/support/controllers/githubish_import_controller_shared_examples.rb index 140490f2dc2..697f999e4c4 100644 --- a/spec/support/controllers/githubish_import_controller_shared_examples.rb +++ b/spec/support/controllers/githubish_import_controller_shared_examples.rb @@ -17,7 +17,7 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do allow_any_instance_of(Gitlab::LegacyGithubImport::Client) .to receive(:user).and_return(true) - post :personal_access_token, personal_access_token: token + post :personal_access_token, params: { personal_access_token: token } expect(session[:"#{provider}_access_token"]).to eq(token) expect(controller).to redirect_to(status_import_url) @@ -29,7 +29,7 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do allow_any_instance_of(Gitlab::LegacyGithubImport::Client) .to receive(:user).and_return(true) - post :personal_access_token, personal_access_token: " #{token} " + post :personal_access_token, params: { personal_access_token: " #{token} " } expect(session[:"#{provider}_access_token"]).to eq(token) expect(controller).to redirect_to(status_import_url) @@ -214,7 +214,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).and_return(double(execute: project)) - expect { post :create, target_namespace: provider_repo.name, format: :json }.to change(Namespace, :count).by(1) + expect { post :create, params: { target_namespace: provider_repo.name }, format: :json }.to change(Namespace, :count).by(1) end it "takes the new namespace" do @@ -222,7 +222,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, provider_repo.name, an_instance_of(Group), user, access_params, type: provider) .and_return(double(execute: project)) - post :create, target_namespace: provider_repo.name, format: :json + post :create, params: { target_namespace: provider_repo.name }, format: :json end end @@ -261,7 +261,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, test_namespace, user, access_params, type: provider) .and_return(double(execute: project)) - post :create, { target_namespace: test_namespace.name, new_name: test_name, format: :json } + post :create, params: { target_namespace: test_namespace.name, new_name: test_name }, format: :json end it 'takes the selected name and default namespace' do @@ -269,7 +269,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) .and_return(double(execute: project)) - post :create, { new_name: test_name, format: :json } + post :create, params: { new_name: test_name }, format: :json end end @@ -288,7 +288,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, nested_namespace, user, access_params, type: provider) .and_return(double(execute: project)) - post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :json } + post :create, params: { target_namespace: nested_namespace.full_path, new_name: test_name }, format: :json end end @@ -300,7 +300,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } + post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json end it 'creates the namespaces' do @@ -308,7 +308,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } } + expect { post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json } .to change { Namespace.count }.by(2) end @@ -317,7 +317,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } + post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo') end @@ -336,7 +336,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } + post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :json end it 'creates the namespaces' do @@ -344,7 +344,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } } + expect { post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :json } .to change { Namespace.count }.by(2) end @@ -353,7 +353,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) .and_return(double(execute: build_stubbed(:project))) - expect { post :create, { target_namespace: "#{user.namespace_path}/test_group", new_name: test_name, format: :js } } + expect { post :create, params: { target_namespace: "#{user.namespace_path}/test_group", new_name: test_name }, format: :js } .not_to change { Namespace.count } end end @@ -367,7 +367,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) .and_return(double(execute: build_stubbed(:project))) - post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } + post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :js end it 'does not create the namespaces' do @@ -375,7 +375,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) .and_return(double(execute: build_stubbed(:project))) - expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } } + expect { post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :js } .not_to change { Namespace.count } end end @@ -392,7 +392,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do .to receive(:new).with(provider_repo, test_name, group, user, access_params, type: provider) .and_return(double(execute: build_stubbed(:project))) - post :create, { target_namespace: 'foo', new_name: test_name, format: :js } + post :create, params: { target_namespace: 'foo', new_name: test_name }, format: :js end end @@ -400,7 +400,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'returns 422 response' do other_namespace = create(:group, name: 'other_namespace') - post :create, { target_namespace: other_namespace.name, format: :json } + post :create, params: { target_namespace: other_namespace.name }, format: :json expect(response).to have_gitlab_http_status(422) end diff --git a/spec/support/helpers/git_http_helpers.rb b/spec/support/helpers/git_http_helpers.rb index 9a5845af90c..cd49bb148f2 100644 --- a/spec/support/helpers/git_http_helpers.rb +++ b/spec/support/helpers/git_http_helpers.rb @@ -1,18 +1,18 @@ module GitHttpHelpers def clone_get(project, options = {}) - get "/#{project}/info/refs", { service: 'git-upload-pack' }, auth_env(*options.values_at(:user, :password, :spnego_request_token)) + get "/#{project}/info/refs", params: { service: 'git-upload-pack' }, headers: auth_env(*options.values_at(:user, :password, :spnego_request_token)) end def clone_post(project, options = {}) - post "/#{project}/git-upload-pack", {}, auth_env(*options.values_at(:user, :password, :spnego_request_token)) + post "/#{project}/git-upload-pack", headers: auth_env(*options.values_at(:user, :password, :spnego_request_token)) end def push_get(project, options = {}) - get "/#{project}/info/refs", { service: 'git-receive-pack' }, auth_env(*options.values_at(:user, :password, :spnego_request_token)) + get "/#{project}/info/refs", params: { service: 'git-receive-pack' }, headers: auth_env(*options.values_at(:user, :password, :spnego_request_token)) end def push_post(project, options = {}) - post "/#{project}/git-receive-pack", {}, auth_env(*options.values_at(:user, :password, :spnego_request_token)) + post "/#{project}/git-receive-pack", headers: auth_env(*options.values_at(:user, :password, :spnego_request_token)) end def download(project, user: nil, password: nil, spnego_request_token: nil) diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index 75827df80dc..dd32ea3985f 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -107,7 +107,7 @@ module GraphqlHelpers end def post_graphql(query, current_user: nil, variables: nil) - post api('/', current_user, version: 'graphql'), query: query, variables: variables + post api('/', current_user, version: 'graphql'), params: { query: query, variables: variables } end def post_graphql_mutation(mutation, current_user: nil) diff --git a/spec/support/issuables_requiring_filter_shared_examples.rb b/spec/support/issuables_requiring_filter_shared_examples.rb index 439ef5ed92e..71bcc82ee58 100644 --- a/spec/support/issuables_requiring_filter_shared_examples.rb +++ b/spec/support/issuables_requiring_filter_shared_examples.rb @@ -10,6 +10,6 @@ shared_examples 'issuables requiring filter' do |action| it "loads issuables if at least one filter is set" do expect_any_instance_of(described_class).to receive(:issuables_collection).and_call_original - get action, author_id: user.id + get action, params: { author_id: user.id } end end diff --git a/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb b/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb index 7088fb1e5fb..59708173716 100644 --- a/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb +++ b/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb @@ -8,8 +8,7 @@ shared_examples 'handle uploads' do describe "POST #create" do context 'when a user is not authorized to upload a file' do it 'returns 404 status' do - post :create, params.merge(file: jpg, format: :json) - + post :create, params: params.merge(file: jpg), format: :json expect(response.status).to eq(404) end end @@ -22,7 +21,7 @@ shared_examples 'handle uploads' do context "without params['file']" do it "returns an error" do - post :create, params.merge(format: :json) + post :create, params: params, format: :json expect(response).to have_gitlab_http_status(422) end @@ -30,7 +29,7 @@ shared_examples 'handle uploads' do context 'with valid image' do before do - post :create, params.merge(file: jpg, format: :json) + post :create, params: params.merge(file: jpg), format: :json end it 'returns a content with original filename, new link, and correct type.' do @@ -54,7 +53,7 @@ shared_examples 'handle uploads' do context 'with valid non-image file' do before do - post :create, params.merge(file: txt, format: :json) + post :create, params: params.merge(file: txt), format: :json end it 'returns a content with original filename, new link, and correct type.' do @@ -67,7 +66,7 @@ shared_examples 'handle uploads' do describe "GET #show" do let(:show_upload) do - get :show, params.merge(secret: secret, filename: "rails_sample.jpg") + get :show, params: params.merge(secret: secret, filename: "rails_sample.jpg") end before do diff --git a/spec/support/shared_examples/milestone_tabs_examples.rb b/spec/support/shared_examples/milestone_tabs_examples.rb index 70b499198bf..8b757586941 100644 --- a/spec/support/shared_examples/milestone_tabs_examples.rb +++ b/spec/support/shared_examples/milestone_tabs_examples.rb @@ -10,7 +10,7 @@ shared_examples 'milestone tabs' do { namespace_id: project.namespace.to_param, project_id: project, id: milestone.iid } end - get path, params.merge(extra_params) + get path, params: params.merge(extra_params) end describe '#merge_requests' do diff --git a/spec/support/shared_examples/requests/api/merge_requests_list.rb b/spec/support/shared_examples/requests/api/merge_requests_list.rb index 92d4dd598d5..453f42251c8 100644 --- a/spec/support/shared_examples/requests/api/merge_requests_list.rb +++ b/spec/support/shared_examples/requests/api/merge_requests_list.rb @@ -123,7 +123,7 @@ shared_examples 'merge requests list' do end it 'returns an empty array if no issue matches milestone' do - get api(endpoint_path, user), milestone: '1.0.0' + get api(endpoint_path, user), params: { milestone: '1.0.0' } expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array @@ -131,7 +131,7 @@ shared_examples 'merge requests list' do end it 'returns an empty array if milestone does not exist' do - get api(endpoint_path, user), milestone: 'foo' + get api(endpoint_path, user), params: { milestone: 'foo' } expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array @@ -139,7 +139,7 @@ shared_examples 'merge requests list' do end it 'returns an array of merge requests in given milestone' do - get api(endpoint_path, user), milestone: '0.9' + get api(endpoint_path, user), params: { milestone: '0.9' } closed_issues = json_response.select { |mr| mr['id'] == merge_request_closed.id } expect(closed_issues.length).to eq(1) @@ -147,7 +147,7 @@ shared_examples 'merge requests list' do end it 'returns an array of merge requests matching state in milestone' do - get api(endpoint_path, user), milestone: '0.9', state: 'closed' + get api(endpoint_path, user), params: { milestone: '0.9', state: 'closed' } expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array @@ -187,7 +187,7 @@ shared_examples 'merge requests list' do end it 'returns an array of merge requests with any label when filtering by any label' do - get api(endpoint_path, user), labels: IssuesFinder::FILTER_ANY + get api(endpoint_path, user), params: { labels: IssuesFinder::FILTER_ANY } expect_paginated_array_response expect(json_response.length).to eq(1) @@ -195,7 +195,7 @@ shared_examples 'merge requests list' do end it 'returns an array of merge requests without a label when filtering by no label' do - get api(endpoint_path, user), labels: IssuesFinder::FILTER_NONE + get api(endpoint_path, user), params: { labels: IssuesFinder::FILTER_NONE } response_ids = json_response.map { |merge_request| merge_request['id'] } @@ -286,7 +286,7 @@ shared_examples 'merge requests list' do context 'source_branch param' do it 'returns merge requests with the given source branch' do - get api(endpoint_path, user), source_branch: merge_request_closed.source_branch, state: 'all' + get api(endpoint_path, user), params: { source_branch: merge_request_closed.source_branch, state: 'all' } expect_response_contain_exactly(merge_request_closed, merge_request_merged, merge_request_locked) end @@ -294,7 +294,7 @@ shared_examples 'merge requests list' do context 'target_branch param' do it 'returns merge requests with the given target branch' do - get api(endpoint_path, user), target_branch: merge_request_closed.target_branch, state: 'all' + get api(endpoint_path, user), params: { target_branch: merge_request_closed.target_branch, state: 'all' } expect_response_contain_exactly(merge_request_closed, merge_request_merged, merge_request_locked) end diff --git a/spec/support/shared_examples/requests/api/notes.rb b/spec/support/shared_examples/requests/api/notes.rb index 0e20dfe0725..627c5682609 100644 --- a/spec/support/shared_examples/requests/api/notes.rb +++ b/spec/support/shared_examples/requests/api/notes.rb @@ -118,7 +118,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name| context 'by an admin' do it 'sets the creation time on the new note' do admin = create(:admin) - post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", admin), params + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", admin), params: params expect(response).to have_gitlab_http_status(201) expect(json_response['body']).to eq('hi!') @@ -131,7 +131,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name| if parent_type == 'projects' context 'by a project owner' do it 'sets the creation time on the new note' do - post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user), params + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user), params: params expect(response).to have_gitlab_http_status(201) expect(json_response['body']).to eq('hi!') @@ -149,7 +149,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name| parent.update!(namespace: group) user2.refresh_authorized_projects - post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user2), params + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user2), params: params expect(response).to have_gitlab_http_status(201) expect(json_response['body']).to eq('hi!') @@ -161,7 +161,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name| elsif parent_type == 'groups' context 'by a group owner' do it 'sets the creation time on the new note' do - post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user), params + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user), params: params expect(response).to have_gitlab_http_status(201) expect(json_response['body']).to eq('hi!') @@ -176,7 +176,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name| it 'ignores the given creation time' do user2 = create(:user) parent.add_developer(user2) - post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user2), params + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user2), params: params expect(response).to have_gitlab_http_status(201) expect(json_response['body']).to eq('hi!') diff --git a/spec/support/shared_examples/requests/api/resolvable_discussions.rb b/spec/support/shared_examples/requests/api/resolvable_discussions.rb index 408ad08cc48..2c5c776413a 100644 --- a/spec/support/shared_examples/requests/api/resolvable_discussions.rb +++ b/spec/support/shared_examples/requests/api/resolvable_discussions.rb @@ -2,7 +2,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_ describe "PUT /#{parent_type}/:id/#{noteable_type}/:noteable_id/discussions/:discussion_id" do it "resolves discussion if resolved is true" do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}", user), resolved: true + "discussions/#{note.discussion_id}", user), params: { resolved: true } expect(response).to have_gitlab_http_status(200) expect(json_response['notes'].size).to eq(1) @@ -11,7 +11,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_ it "unresolves discussion if resolved is false" do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}", user), resolved: false + "discussions/#{note.discussion_id}", user), params: { resolved: false } expect(response).to have_gitlab_http_status(200) expect(json_response['notes'].size).to eq(1) @@ -27,14 +27,14 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_ it "returns a 401 unauthorized error if user is not authenticated" do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}"), resolved: true + "discussions/#{note.discussion_id}"), params: { resolved: true } expect(response).to have_gitlab_http_status(401) end it "returns a 403 error if user resolves discussion of someone else" do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}", private_user), resolved: true + "discussions/#{note.discussion_id}", private_user), params: { resolved: true } expect(response).to have_gitlab_http_status(403) end @@ -46,7 +46,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_ it 'responds with 404' do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}", private_user), resolved: true + "discussions/#{note.discussion_id}", private_user), params: { resolved: true } expect(response).to have_gitlab_http_status(404) end @@ -56,7 +56,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_ describe "PUT /#{parent_type}/:id/#{noteable_type}/:noteable_id/discussions/:discussion_id/notes/:note_id" do it 'returns resolved note when resolved parameter is true' do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}/notes/#{note.id}", user), resolved: true + "discussions/#{note.discussion_id}/notes/#{note.id}", user), params: { resolved: true } expect(response).to have_gitlab_http_status(200) expect(json_response['resolved']).to eq(true) @@ -79,7 +79,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_ it "returns a 403 error if user resolves note of someone else" do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}/notes/#{note.id}", private_user), resolved: true + "discussions/#{note.discussion_id}/notes/#{note.id}", private_user), params: { resolved: true } expect(response).to have_gitlab_http_status(403) end |