Skip to content

Commit 8e0df8d

Browse files
committed
Update specs for rails main
1 parent 22105e0 commit 8e0df8d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

spec/rspec/rails/matchers/action_cable/have_stream_spec.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,16 @@ def subscribed
158158
it "fails with message" do
159159
subscribe user: 42
160160

161+
broadcast_preamble =
162+
if Rails.version.to_f < 8.1
163+
"broadcast:StreamModel#"
164+
else
165+
"broadcast:"
166+
end
167+
161168
expect {
162169
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"\]/)
164171
end
165172

166173
context "with negated form" do
@@ -173,9 +180,16 @@ def subscribed
173180
it "fails with message" do
174181
subscribe user: 42
175182

183+
broadcast_id =
184+
if Rails.version.to_f < 8.1
185+
"broadcast:StreamModel#42"
186+
else
187+
"broadcast:42"
188+
end
189+
176190
expect {
177191
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}"\]/)
179193
end
180194
end
181195
end

0 commit comments

Comments
 (0)