diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-12-18 01:52:17 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-12-19 02:04:31 +0300 |
commit | b44a2c801a64fb282cea794871fcfcf81e4ec539 (patch) | |
tree | 32e699b6efa548048abe11f29f84e85e3d2a034f /spec/controllers/import | |
parent | 5d68c23792e87e710877e4baf57605bcf11a6cb5 (diff) |
Update specs to rails5 format
Updates specs to use new rails5 format.
The old format:
`get :show, { some: params }, { some: headers }`
The new format:
`get :show, params: { some: params }, headers: { some: headers }`
Diffstat (limited to 'spec/controllers/import')
5 files changed, 25 insertions, 25 deletions
diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index be49b92d23f..51793f2c048 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -237,7 +237,7 @@ describe Import::BitbucketController do .to receive(:new).with(bitbucket_repo, test_name, nested_namespace, user, access_params) .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 @@ -249,7 +249,7 @@ describe Import::BitbucketController do .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .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 @@ -257,7 +257,7 @@ describe Import::BitbucketController do .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .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 @@ -266,7 +266,7 @@ describe Import::BitbucketController do .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .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 @@ -285,7 +285,7 @@ describe Import::BitbucketController do .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .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 @@ -293,7 +293,7 @@ describe Import::BitbucketController do .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .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 end @@ -302,7 +302,7 @@ describe Import::BitbucketController 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/controllers/import/bitbucket_server_controller_spec.rb b/spec/controllers/import/bitbucket_server_controller_spec.rb index db912641894..73195463a50 100644 --- a/spec/controllers/import/bitbucket_server_controller_spec.rb +++ b/spec/controllers/import/bitbucket_server_controller_spec.rb @@ -42,19 +42,19 @@ describe Import::BitbucketServerController do .to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything) .and_return(double(execute: project)) - post :create, project: project_key, repository: repo_slug, format: :json + post :create, params: { project: project_key, repository: repo_slug }, format: :json expect(response).to have_gitlab_http_status(200) end it 'returns an error when an invalid project key is used' do - post :create, project: 'some&project' + post :create, params: { project: 'some&project' } expect(response).to have_gitlab_http_status(422) end it 'returns an error when an invalid repository slug is used' do - post :create, project: 'some-project', repository: 'try*this' + post :create, params: { project: 'some-project', repository: 'try*this' } expect(response).to have_gitlab_http_status(422) end @@ -62,7 +62,7 @@ describe Import::BitbucketServerController do it 'returns an error when the project cannot be found' do allow(client).to receive(:repo).with(project_key, repo_slug).and_return(nil) - post :create, project: project_key, repository: repo_slug, format: :json + post :create, params: { project: project_key, repository: repo_slug }, format: :json expect(response).to have_gitlab_http_status(422) end @@ -72,7 +72,7 @@ describe Import::BitbucketServerController do .to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything) .and_return(double(execute: build(:project))) - post :create, project: project_key, repository: repo_slug, format: :json + post :create, params: { project: project_key, repository: repo_slug }, format: :json expect(response).to have_gitlab_http_status(422) end @@ -80,7 +80,7 @@ describe Import::BitbucketServerController do it "returns an error when the server can't be contacted" do expect(client).to receive(:repo).with(project_key, repo_slug).and_raise(BitbucketServer::Client::ServerError) - post :create, project: project_key, repository: repo_slug, format: :json + post :create, params: { project: project_key, repository: repo_slug }, format: :json expect(response).to have_gitlab_http_status(422) end @@ -103,7 +103,7 @@ describe Import::BitbucketServerController do end it 'sets the session variables' do - post :configure, personal_access_token: token, bitbucket_username: username, bitbucket_server_url: url + post :configure, params: { personal_access_token: token, bitbucket_username: username, bitbucket_server_url: url } expect(session[:bitbucket_server_url]).to eq(url) expect(session[:bitbucket_server_username]).to eq(username) diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb index 742f4787126..a874a7d36f6 100644 --- a/spec/controllers/import/gitlab_controller_spec.rb +++ b/spec/controllers/import/gitlab_controller_spec.rb @@ -209,7 +209,7 @@ describe Import::GitlabController do .to receive(:new).with(gitlab_repo, nested_namespace, user, access_params) .and_return(double(execute: project)) - post :create, { target_namespace: nested_namespace.full_path, format: :json } + post :create, params: { target_namespace: nested_namespace.full_path }, format: :json end end @@ -221,7 +221,7 @@ describe Import::GitlabController do .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', format: :json } + post :create, params: { target_namespace: 'foo/bar' }, format: :json end it 'creates the namespaces' do @@ -229,7 +229,7 @@ describe Import::GitlabController do .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/bar', format: :json } } + expect { post :create, params: { target_namespace: 'foo/bar' }, format: :json } .to change { Namespace.count }.by(2) end @@ -238,7 +238,7 @@ describe Import::GitlabController do .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', format: :json } + post :create, params: { target_namespace: 'foo/bar' }, format: :json expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo') end @@ -257,7 +257,7 @@ describe Import::GitlabController do .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/foobar/bar', format: :json } + post :create, params: { target_namespace: 'foo/foobar/bar' }, format: :json end it 'creates the namespaces' do @@ -265,7 +265,7 @@ describe Import::GitlabController do .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/foobar/bar', format: :json } } + expect { post :create, params: { target_namespace: 'foo/foobar/bar' }, format: :json } .to change { Namespace.count }.by(2) end end @@ -274,7 +274,7 @@ describe Import::GitlabController 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/controllers/import/gitlab_projects_controller_spec.rb b/spec/controllers/import/gitlab_projects_controller_spec.rb index cbd1a112602..55bd8ae7182 100644 --- a/spec/controllers/import/gitlab_projects_controller_spec.rb +++ b/spec/controllers/import/gitlab_projects_controller_spec.rb @@ -12,14 +12,14 @@ describe Import::GitlabProjectsController do describe 'POST create' do context 'with an invalid path' do it 'redirects with an error' do - post :create, namespace_id: namespace.id, path: '/test', file: file + post :create, params: { namespace_id: namespace.id, path: '/test', file: file } expect(flash[:alert]).to start_with('Project could not be imported') expect(response).to have_gitlab_http_status(302) end it 'redirects with an error when a relative path is used' do - post :create, namespace_id: namespace.id, path: '../test', file: file + post :create, params: { namespace_id: namespace.id, path: '../test', file: file } expect(flash[:alert]).to start_with('Project could not be imported') expect(response).to have_gitlab_http_status(302) @@ -28,7 +28,7 @@ describe Import::GitlabProjectsController do context 'with a valid path' do it 'redirects to the new project path' do - post :create, namespace_id: namespace.id, path: 'test', file: file + post :create, params: { namespace_id: namespace.id, path: 'test', file: file } expect(flash[:notice]).to include('is being imported') expect(response).to have_gitlab_http_status(302) diff --git a/spec/controllers/import/google_code_controller_spec.rb b/spec/controllers/import/google_code_controller_spec.rb index 0763492d88a..3e5ed2afd93 100644 --- a/spec/controllers/import/google_code_controller_spec.rb +++ b/spec/controllers/import/google_code_controller_spec.rb @@ -12,7 +12,7 @@ describe Import::GoogleCodeController do describe "POST callback" do it "stores Google Takeout dump list in session" do - post :callback, dump_file: dump_file + post :callback, params: { dump_file: dump_file } expect(session[:google_code_dump]).to be_a(Hash) expect(session[:google_code_dump]["kind"]).to eq("projecthosting#user") |