Skip to content

Commit 240e860

Browse files
committed
Use new_attributes instead of invalid_attributes for testing PATCH /update with valid parameters.
1 parent 9ce4e65 commit 240e860

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/generators/rspec/scaffold/templates/api_request_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@
9494
it "updates the requested <%= ns_file_name %>" do
9595
<%= file_name %> = <%= class_name %>.create! valid_attributes
9696
patch <%= show_helper.tr('@', '') %>,
97-
params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
97+
params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
9898
<%= file_name %>.reload
9999
skip("Add assertions for updated state")
100100
end
101101
102102
it "renders a JSON response with the <%= ns_file_name %>" do
103103
<%= file_name %> = <%= class_name %>.create! valid_attributes
104104
patch <%= show_helper.tr('@', '') %>,
105-
params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
105+
params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
106106
expect(response).to have_http_status(:ok)
107-
expect(response.content_type).to eq("application/json")
107+
expect(response.content_type).to match(a_string_including("application/json"))
108108
end
109109
end
110110

0 commit comments

Comments
 (0)