Skip to content

Commit 0d0ed01

Browse files
committed
checking 422 status for different rails versions
1 parent e2d6c3f commit 0d0ed01

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@
8282
}.to change(<%= class_name %>, :count).by(0)
8383
end
8484
85-
it "renders a successful response (i.e. to display the 'new' template)" do
85+
it "renders a response with 422 status - unporcessable entity" do
8686
post <%= index_helper %>_url, params: { <%= ns_file_name %>: invalid_attributes }
87-
expect(response).to be_successful
87+
expect(response.status).to eq(422)
8888
end
8989
end
9090
end
@@ -114,7 +114,7 @@
114114
it "renders a successful response (i.e. to display the 'edit' template)" do
115115
<%= file_name %> = <%= class_name %>.create! valid_attributes
116116
patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: invalid_attributes }
117-
expect(response).to be_successful
117+
expect(response.status).to eq(422)
118118
end
119119
end
120120
end

0 commit comments

Comments
 (0)