Skip to content

Commit 429b659

Browse files
authored
Merge pull request #2591 from taketo1113/controller-spec-update
Fixed params PUT #update with valid params in controller spec
2 parents ae9265f + 438aab3 commit 429b659

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
101101
it "renders a JSON response with the <%= singular_table_name %>" do
102102
<%= file_name %> = <%= class_name %>.create! valid_attributes
103-
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session
103+
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session
104104
expect(response).to have_http_status(:ok)
105105
expect(response.content_type).to eq('application/json')
106106
end

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
120120
it "redirects to the <%= singular_table_name %>" do
121121
<%= file_name %> = <%= class_name %>.create! valid_attributes
122-
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session
122+
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session
123123
expect(response).to redirect_to(<%= file_name %>)
124124
end
125125
end

0 commit comments

Comments
 (0)