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 6b75bc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/generators/rspec/scaffold/templates/api_request_spec.rb
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
13 changes: 13 additions & 0 deletions lib/rspec/rails/version.rb.orig
@@ -0,0 +1,13 @@
module RSpec
module Rails
# Version information for RSpec Rails.
module Version
# Current version of RSpec Rails, in semantic versioning format.
<<<<<<< HEAD
STRING = '4.0.1'
=======
STRING = '4.0.0.pre'
>>>>>>> 115f1cc6... Follow pre versioning format
end
end
end

0 comments on commit 6b75bc8

Please sign in to comment.