Skip to content

Commit 1c35c19

Browse files
committed
Merge pull request #2591 from taketo1113/controller-spec-update
Fixed params PUT #update with valid params in controller spec
1 parent 056432f commit 1c35c19

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
@@ -112,7 +112,7 @@
112112
113113
it "redirects to the <%= singular_table_name %>" do
114114
<%= file_name %> = <%= class_name %>.create! valid_attributes
115-
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session
115+
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session
116116
expect(response).to redirect_to(<%= file_name %>)
117117
end
118118
end

0 commit comments

Comments
 (0)