Skip to content

Commit

Permalink
Use new_attributes instead of invalid_attributes for testing PATCH /u…
Browse files Browse the repository at this point in the history
…pdate with valid parameters.
  • Loading branch information
phanyzewski committed May 25, 2020
1 parent 9ce4e65 commit 240e860
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/generators/rspec/scaffold/templates/api_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@
it "updates the requested <%= ns_file_name %>" do
<%= file_name %> = <%= class_name %>.create! valid_attributes
patch <%= show_helper.tr('@', '') %>,
params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
<%= file_name %>.reload
skip("Add assertions for updated state")
end
it "renders a JSON response with the <%= ns_file_name %>" do
<%= file_name %> = <%= class_name %>.create! valid_attributes
patch <%= show_helper.tr('@', '') %>,
params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
expect(response).to have_http_status(:ok)
expect(response.content_type).to eq("application/json")
expect(response.content_type).to match(a_string_including("application/json"))
end
end
Expand Down

0 comments on commit 240e860

Please sign in to comment.