From 07ae486d5b1e6cc8dc20a16cf8c967bd2104109d Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 14 Apr 2015 22:58:59 +0300 Subject: [PATCH] #465: Update specs for Projects::CommentsController --- .../projects/comments_controller_for_commit_spec.rb | 2 +- spec/support/shared_examples/comments.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/controllers/projects/comments_controller_for_commit_spec.rb b/spec/controllers/projects/comments_controller_for_commit_spec.rb index 3d60f19f3..85433c965 100644 --- a/spec/controllers/projects/comments_controller_for_commit_spec.rb +++ b/spec/controllers/projects/comments_controller_for_commit_spec.rb @@ -8,7 +8,7 @@ describe Projects::CommentsController, type: :controller do @create_params = { comment: { body: 'I am a comment!' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id, format: :json } - @update_params = { comment: { body: 'updated' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id } + @update_params = { comment: { body: 'updated' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id, format: :json } allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) diff --git a/spec/support/shared_examples/comments.rb b/spec/support/shared_examples/comments.rb index 780c49343..5840fdd24 100644 --- a/spec/support/shared_examples/comments.rb +++ b/spec/support/shared_examples/comments.rb @@ -45,25 +45,25 @@ shared_examples_for 'user without update stranger comment ability' do end shared_examples_for 'user with destroy comment ability' do it 'should be able to perform destroy action' do - delete :destroy, {id: @comment.id}.merge(@path) + delete :destroy, {id: @comment.id, format: :json}.merge(@path) expect(response).to be_success #redirect_to(@return_path) end it 'should delete comment from database' do expect do - delete :destroy, {id: @comment.id}.merge(@path) + delete :destroy, {id: @comment.id, format: :json}.merge(@path) end.to change(Comment, :count).by(-1) end end shared_examples_for 'user without destroy comment ability' do it 'should not be able to perform destroy action' do - delete :destroy, {id: @comment.id}.merge(@path) + delete :destroy, {id: @comment.id, format: :json}.merge(@path) expect(response).to redirect_to(forbidden_path) end it 'should not delete comment from database' do expect do - delete :destroy, {id: @comment.id}.merge(@path) + delete :destroy, {id: @comment.id, format: :json}.merge(@path) end.to_not change(Issue, :count) end end