Skip to content

Commit 8806a3b

Browse files
justin808claude
andcommitted
Fix Ruby 3.4 compatibility issues in tests
- PrerenderError test: Handle absolute vs relative paths in backtraces - Utils test: Handle new hash syntax format ({a: "value"} vs {:a=value}) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 74d13ce commit 8806a3b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

spec/react_on_rails/prender_error_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ 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+
# Ruby 3.4+ shows absolute paths, so match the end of the path
69+
expect(message).to include("prender_error_spec.rb:20:in `block (2 levels) in <module:ReactOnRails>'")
7170
expect(message).to include("The rest of the backtrace is hidden")
7271
end
7372
end

spec/react_on_rails/utils_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,9 @@ 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+
# Ruby 3.4+ changed hash syntax, so be flexible about the format
468+
expect(result).to match(/\{(:a=|a: ")#{Regexp.escape(Utils::TRUNCATION_FILLER)}90"\}/)
469469
end
470470
end
471471
end

0 commit comments

Comments
 (0)