rspec / rspec-expectations

Provides a readable API to express expected outcomes of a code example
https://rspec.info
MIT License
1.26k stars 395 forks source link

rspec testsuite fails with ruby3.4.0dev #1488

Open mtasaka opened 1 week ago

mtasaka commented 1 week ago

Trying with ruby 3.4.0dev (2024-11-07 master 048bb1e176) +PRISM [x86_64-linux] https://github.com/ruby/ruby/commit/048bb1e1763c3ea9208a4049b515c15252f19cf1

rspec test suite for rspec-expectations 3.13.3 : https://github.com/rspec/rspec-expectations/commit/838952dc1416c943e7933684c47249a77481e7f5 fails so may like attached. failure.log.txt

Looks like rspec-expectations also needs supporting ruby3.4 formatting change.

mtasaka commented 1 week ago

The full failure log is attached above. The log contains like:

Failures:
  1) expect { ... }.not_to change { block } with a deeply nested object graph fails when part of it is changed
     Failure/Error:
       expect {
         expect { data[0][:a] << 3 }.not_to change { data }
       }.to fail_with(failure_msg)
       expected RSpec::Expectations::ExpectationNotMetError with message matching /expected (?-mix:result|`.+?`) not to have changed, but did change from \[\{a:\ \[1,\ 2\]\}\] to \[\{a:\ \[1,\ 2,\ 3\]\}\]/, got #<RSpec::Expectations::ExpectationNotMetError: expected `data` not to have changed, but did change from [{:a => [1, 2]}] to [{:a => [1, 2, 3]}]> with backtrace:
         # ./spec/rspec/matchers/built_in/change_spec.rb:464:in 'block (4 levels) in <top (required)>'
         # ./spec/rspec/matchers/built_in/change_spec.rb:465:in 'block (3 levels) in <top (required)>'
     # ./spec/rspec/matchers/built_in/change_spec.rb:465:in 'block (3 levels) in <top (required)>'
  2) #have_attributes matcher expect(...).to_not have_attributes(with_one_attribute) fails if target has all of the expected attributes
     Failure/Error:
       expect {
         expect(person).to_not have_attributes(:age => correct_age)
       }.to fail_with(%r|expected #{object_inspect person} not to have attributes #{hash_inspect :age => correct_age}|)
       expected RSpec::Expectations::ExpectationNotMetError with message matching /expected #<struct Person name="Correct name", age=33> not to have attributes {age: 33}/, got #<RSpec::Expectations::ExpectationNotMetError: expected #<struct Person name="Correct name", age=33> not to have attributes {:age => 33}> with backtrace:
         # ./spec/rspec/matchers/built_in/have_attributes_spec.rb:127:in 'block (4 levels) in <top (required)>'
         # ./spec/rspec/matchers/built_in/have_attributes_spec.rb:128:in 'block (3 levels) in <top (required)>'
     # ./spec/rspec/matchers/built_in/have_attributes_spec.rb:128:in 'block (3 levels) in <top (required)>'
...
...