From a4d408e85acbde14d70f4cbf31dd722d861f830e Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Tue, 14 Mar 2023 10:14:11 -0500 Subject: [PATCH] Rails 6.1 spec fixes- update error messages assertion when an invalid put operation (#4142) * update error messages assertion when an invalid put operation * update spec per hound sniffs " to ' --- spec/controllers/api/v1/users_controller_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/controllers/api/v1/users_controller_spec.rb b/spec/controllers/api/v1/users_controller_spec.rb index 842c7e7fc..5190ecad0 100644 --- a/spec/controllers/api/v1/users_controller_spec.rb +++ b/spec/controllers/api/v1/users_controller_spec.rb @@ -561,7 +561,7 @@ def update_request it_behaves_like "an api response" end - context "with a an invalid put operation" do + context 'with an invalid put operation' do before(:each) { update_request } let(:put_operations) { {} } @@ -569,9 +569,11 @@ def update_request expect(response.status).to eq(422) end - it "should return a specific error message in the response body" do - error_message = json_error_message("param is missing or the value is empty: users") - expect(response.body).to eq(error_message) + it 'returns a specific error message in the response body' do + error_message = 'param is missing or the value is empty: users' + errors = JSON.parse(response.body)['errors'] + expect(errors).not_to be_empty + expect(errors[0]['message']).to include(error_message) end it "should not updated the resource attribute" do