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 7
7
include RSpec ::Support ::InSubProcess
8
8
setup_default_destination
9
9
10
+ if Rack ::RELEASE < "3.1.0"
11
+ let ( :unprocessable_status ) { ":unprocessable_entity" }
12
+ else
13
+ let ( :unprocessable_status ) { ":unprocessable_content" }
14
+ end
15
+
10
16
describe 'standard request specs' do
11
17
subject ( :filename ) { file ( 'spec/requests/posts_spec.rb' ) }
12
18
33
39
. and ( contain ( /renders a response with 422 status \( i.e. to display the 'edit' template\) / ) )
34
40
)
35
41
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 } \) / )
45
43
end
46
44
end
47
45
109
107
expect ( filename ) . to contain ( /renders a response with 422 status \( i.e. to display the 'new' template\) / )
110
108
. and ( contain ( /renders a response with 422 status \( i.e. to display the 'edit' template\) / ) )
111
109
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 } \) / )
122
111
expect ( filename ) . not_to contain ( /"renders a JSON response with the new \w +"/ )
123
112
expect ( filename ) . not_to contain ( /"renders a JSON response with errors for the new \w +"/ )
124
113
expect ( filename ) . not_to contain ( /"renders a JSON response with the \w +"/ )
You can’t perform that action at this time.
0 commit comments