From 93bd42ac27894a6e3ed26ad20453bc5a8ca785d0 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 25 May 2020 20:23:45 +0100 Subject: [PATCH] Merge pull request #2344 from phanyzewski/patch_api_request_generator Patch api_request_spec template PATCH/update --- lib/generators/rspec/scaffold/templates/api_request_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/generators/rspec/scaffold/templates/api_request_spec.rb b/lib/generators/rspec/scaffold/templates/api_request_spec.rb index 153884e798..2a8083d6af 100644 --- a/lib/generators/rspec/scaffold/templates/api_request_spec.rb +++ b/lib/generators/rspec/scaffold/templates/api_request_spec.rb @@ -94,7 +94,7 @@ 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 @@ -102,9 +102,9 @@ 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