Skip to content

Commit 6b75bc8

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

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-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

lib/rspec/rails/version.rb.orig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module RSpec
2+
module Rails
3+
# Version information for RSpec Rails.
4+
module Version
5+
# Current version of RSpec Rails, in semantic versioning format.
6+
<<<<<<< HEAD
7+
STRING = '4.0.1'
8+
=======
9+
STRING = '4.0.0.pre'
10+
>>>>>>> 115f1cc6... Follow pre versioning format
11+
end
12+
end
13+
end

0 commit comments

Comments
 (0)