Skip to content

Commit

Permalink
Rails 6.1 spec fixes- update error messages assertion when an invalid…
Browse files Browse the repository at this point in the history
… put operation (#4142)

* update error messages assertion when an invalid put operation

* update spec per hound sniffs " to '
  • Loading branch information
yuenmichelle1 authored Mar 14, 2023
1 parent 325a660 commit a4d408e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions spec/controllers/api/v1/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -561,17 +561,19 @@ 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) { {} }

it "should return an error status" do
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
Expand Down

0 comments on commit a4d408e

Please sign in to comment.