diff options
Diffstat (limited to 'spec/controllers/projects/blob_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/blob_controller_spec.rb | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 9fc6af6a045..38957e96798 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -11,9 +11,11 @@ describe Projects::BlobController do context 'with file path' do before do get(:show, - namespace_id: project.namespace, - project_id: project, - id: id) + params: { + namespace_id: project.namespace, + project_id: project, + id: id + }) end context "valid branch, valid file" do @@ -48,9 +50,11 @@ describe Projects::BlobController do before do get(:show, - namespace_id: project.namespace, - project_id: project, - id: id, + params: { + namespace_id: project.namespace, + project_id: project, + id: id + }, format: :json) end @@ -66,11 +70,13 @@ describe Projects::BlobController do before do get(:show, - namespace_id: project.namespace, - project_id: project, - id: id, - format: :json, - viewer: 'none') + params: { + namespace_id: project.namespace, + project_id: project, + id: id, + viewer: 'none' + }, + format: :json) end it do @@ -84,9 +90,11 @@ describe Projects::BlobController do context 'with tree path' do before do get(:show, - namespace_id: project.namespace, - project_id: project, - id: id) + params: { + namespace_id: project.namespace, + project_id: project, + id: id + }) controller.instance_variable_set(:@blob, nil) end @@ -109,7 +117,7 @@ describe Projects::BlobController do params = { namespace_id: project.namespace, project_id: project, id: 'master/CHANGELOG' } - get :diff, params.merge(opts) + get :diff, params: params.merge(opts) end before do @@ -200,7 +208,7 @@ describe Projects::BlobController do context 'anonymous' do before do - get :edit, default_params + get :edit, params: default_params end it 'redirects to sign in and returns' do @@ -213,7 +221,7 @@ describe Projects::BlobController do before do sign_in(guest) - get :edit, default_params + get :edit, params: default_params end it 'redirects to blob show' do @@ -227,7 +235,7 @@ describe Projects::BlobController do before do project.add_developer(developer) sign_in(developer) - get :edit, default_params + get :edit, params: default_params end it 'redirects to blob show' do @@ -241,7 +249,7 @@ describe Projects::BlobController do before do project.add_maintainer(maintainer) sign_in(maintainer) - get :edit, default_params + get :edit, params: default_params end it 'redirects to blob show' do @@ -274,7 +282,7 @@ describe Projects::BlobController do end it 'redirects to blob' do - put :update, default_params + put :update, params: default_params expect(response).to redirect_to(blob_after_edit_path) end @@ -284,7 +292,7 @@ describe Projects::BlobController do let(:mr_params) { default_params.merge(from_merge_request_iid: merge_request.iid) } it 'redirects to MR diff' do - put :update, mr_params + put :update, params: mr_params after_edit_path = diffs_project_merge_request_path(project, merge_request) file_anchor = "##{Digest::SHA1.hexdigest('CHANGELOG')}" @@ -298,7 +306,7 @@ describe Projects::BlobController do end it "it redirect to blob" do - put :update, mr_params + put :update, params: mr_params expect(response).to redirect_to(blob_after_edit_path) end @@ -320,7 +328,7 @@ describe Projects::BlobController do end it 'redirects to blob' do - put :update, default_params + put :update, params: default_params expect(response).to redirect_to(project_blob_path(forked_project, 'master/CHANGELOG')) end @@ -331,7 +339,7 @@ describe Projects::BlobController do default_params[:branch_name] = "fork-test-1" default_params[:create_merge_request] = 1 - put :update, default_params + put :update, params: default_params expect(response).to redirect_to( project_new_merge_request_path( @@ -374,7 +382,7 @@ describe Projects::BlobController do let(:after_delete_path) { project_tree_path(project, 'master/files') } it 'redirects to the sub directory' do - delete :destroy, default_params + delete :destroy, params: default_params expect(response).to redirect_to(after_delete_path) end @@ -393,7 +401,7 @@ describe Projects::BlobController do end it 'redirects to the project root' do - delete :destroy, default_params + delete :destroy, params: default_params expect(response).to redirect_to(project_root_path) end @@ -413,7 +421,7 @@ describe Projects::BlobController do let(:after_delete_path) { project_tree_path(project, 'binary-encoding') } it 'redirects to the project root of the branch' do - delete :destroy, default_params + delete :destroy, params: default_params expect(response).to redirect_to(after_delete_path) end |