File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
lib/generators/rspec/scaffold/templates
generators/rspec/scaffold
rspec/rails/matchers/action_cable Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 18
18
19
19
it "renders a list of <%= ns_table_name %>" do
20
20
render
21
+ <% if Rails.version.to_f < 8.1 -%>
21
22
cell_selector = 'div>p'
23
+ <% else -%>
24
+ cell_selector = 'div>div>div'
25
+ <% end -%>
22
26
<% for attribute in output_attributes -%>
23
27
assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
24
28
<% end -%>
Original file line number Diff line number Diff line change 264
264
. and ( contain ( /assign\( :posts, / ) )
265
265
. and ( contain ( /it "renders a list of (.*)"/ ) )
266
266
267
- expect ( filename ) . to contain ( /'div>p'/ )
267
+ selector =
268
+ if Rails . version . to_f < 8.1
269
+ /'div>p'/
270
+ else
271
+ /'div>div>div'/
272
+ end
273
+
274
+ expect ( filename ) . to contain ( selector )
268
275
end
269
276
end
270
277
Original file line number Diff line number Diff line change @@ -158,9 +158,16 @@ def subscribed
158
158
it "fails with message" do
159
159
subscribe user : 42
160
160
161
+ broadcast_preamble =
162
+ if Rails . version . to_f < 8.1
163
+ "broadcast:StreamModel#"
164
+ else
165
+ "broadcast:"
166
+ end
167
+
161
168
expect {
162
169
expect ( subscription ) . to have_stream_for ( StreamModel . new ( 31_337 ) )
163
- } . to raise_error ( /expected to have stream "broadcast:StreamModel# 31337" started, but have \[ "broadcast:StreamModel# 42"\] / )
170
+ } . to raise_error ( /expected to have stream "#{ broadcast_preamble } 31337" started, but have \[ "#{ broadcast_preamble } 42"\] / )
164
171
end
165
172
166
173
context "with negated form" do
@@ -173,9 +180,16 @@ def subscribed
173
180
it "fails with message" do
174
181
subscribe user : 42
175
182
183
+ broadcast_id =
184
+ if Rails . version . to_f < 8.1
185
+ "broadcast:StreamModel#42"
186
+ else
187
+ "broadcast:42"
188
+ end
189
+
176
190
expect {
177
191
expect ( subscription ) . not_to have_stream_for ( StreamModel . new ( 42 ) )
178
- } . to raise_error ( /expected not to have stream "broadcast:StreamModel#42 " started, but have \[ "broadcast:StreamModel#42 "\] / )
192
+ } . to raise_error ( /expected not to have stream "#{ broadcast_id } " started, but have \[ "#{ broadcast_id } "\] / )
179
193
end
180
194
end
181
195
end
You can’t perform that action at this time.
0 commit comments