Skip to content

Commit b0e2ce2

Browse files
committed
ci: fix ruby 3.4 compatibility failures
1 parent f6a3983 commit b0e2ce2

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

spec/react_on_rails/prender_error_spec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ module ReactOnRails
6565
it "shows truncated backtrace with notice" do
6666
message = expected_error.message
6767
expect(message).to include(err.inspect)
68-
expect(message).to include(
69-
"spec/react_on_rails/prender_error_spec.rb:20:in `block (2 levels) in <module:ReactOnRails>'"
70-
)
68+
69+
# Ruby 3.4 includes class/module names in backtrace method names, but core pattern remains
70+
# Ruby 3.3: "spec/react_on_rails/prender_error_spec.rb:20:in `block (2 levels) in <module:ReactOnRails>'"
71+
# Ruby 3.4: "spec/react_on_rails/prender_error_spec.rb:20:in `SomeClass#block (2 levels) in <module:ReactOnRails>'"
72+
expect(message).to include("spec/react_on_rails/prender_error_spec.rb:20")
73+
expect(message).to include("block (2 levels) in <module:ReactOnRails>")
74+
7175
expect(message).to include("The rest of the backtrace is hidden")
7276
end
7377
end

spec/react_on_rails/utils_spec.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,16 @@ def mock_dev_server_running
463463

464464
it "trims handles a hash" do
465465
s = { a: "1234567890" }
466-
expect(described_class.smart_trim(s, 9)).to eq(
467-
"{:a=#{Utils::TRUNCATION_FILLER}890\"}"
468-
)
466+
result = described_class.smart_trim(s, 9)
467+
468+
# Ruby 3.4+ uses modern hash syntax: {a: "value"}
469+
# Ruby 3.3 uses old syntax: {:a=>"value"}
470+
expected_modern = "{a: #{Utils::TRUNCATION_FILLER}890\"}"
471+
expected_legacy = "{:a=#{Utils::TRUNCATION_FILLER}890\"}"
472+
473+
expect(result).to satisfy("match either Ruby 3.3 or 3.4+ hash format") do |value|
474+
value == expected_modern || value == expected_legacy
475+
end
469476
end
470477
end
471478
end

0 commit comments

Comments
 (0)