File tree Expand file tree Collapse file tree 1 file changed +8
-19
lines changed
spec/generators/rspec/scaffold Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change 77 include RSpec ::Support ::InSubProcess
88 setup_default_destination
99
10+ if Rack ::RELEASE < "3.1.0"
11+ let ( :unprocessable_status ) { ":unprocessable_entity" }
12+ else
13+ let ( :unprocessable_status ) { ":unprocessable_content" }
14+ end
15+
1016 describe 'standard request specs' do
1117 subject ( :filename ) { file ( 'spec/requests/posts_spec.rb' ) }
1218
3339 . and ( contain ( /renders a response with 422 status \( i.e. to display the 'edit' template\) / ) )
3440 )
3541
36- expect (
37- filename
38- ) . to (
39- if Gem ::Version . new ( Rack ::RELEASE ) < Gem ::Version . new ( "3.1" )
40- contain ( /expect\( response\) .to have_http_status\( :unprocessable_entity\) / )
41- else
42- contain ( /expect\( response\) .to have_http_status\( :unprocessable_content\) / )
43- end
44- )
42+ expect ( filename ) . to contain ( /expect\( response\) .to have_http_status\( #{ unprocessable_status } \) / )
4543 end
4644 end
4745
109107 expect ( filename ) . to contain ( /renders a response with 422 status \( i.e. to display the 'new' template\) / )
110108 . and ( contain ( /renders a response with 422 status \( i.e. to display the 'edit' template\) / ) )
111109
112- expect (
113- filename
114- ) . to (
115- if Gem ::Version . new ( Rack ::RELEASE ) < Gem ::Version . new ( "3.1" )
116- contain ( /expect\( response\) .to have_http_status\( :unprocessable_entity\) / )
117- else
118- contain ( /expect\( response\) .to have_http_status\( :unprocessable_content\) / )
119- end
120- )
121-
110+ expect ( filename ) . to contain ( /expect\( response\) .to have_http_status\( #{ unprocessable_status } \) / )
122111 expect ( filename ) . not_to contain ( /"renders a JSON response with the new \w +"/ )
123112 expect ( filename ) . not_to contain ( /"renders a JSON response with errors for the new \w +"/ )
124113 expect ( filename ) . not_to contain ( /"renders a JSON response with the \w +"/ )
You can’t perform that action at this time.
0 commit comments