-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Composing match
matcher work well for the Delegator
gem.
Following is an example code.
# test_spec.rb
require 'delegate'
RSpec.describe SimpleDelegator do
example 'simple match matcher works well for Delegator' do
obj = SimpleDelegator.new([1, 2, 3])
expect(obj).to match([1, 2, 3])
end
example 'composing match matcher does not work well for Delegator' do
obj = SimpleDelegator.new([1, 2, 3])
expect(obj).to match([eq(1), eq(2), eq(3)])
end
en
Both examples should be succeeded but the 2nd example is failed.
$ rspec test_spec.rb
.F
Failures:
1) SimpleDelegator composing match matcher does not work well for Delegator
Failure/Error: expect(obj).to match([eq(1), eq(2), eq(3)])
expected #<SimpleDelegator([1, 2, 3])> to match [(eq 1), (eq 2), (eq 3)]
# ./test_spec.rb:11:in 'block (2 levels) in <top (required)>'
Finished in 0.01259 seconds (files took 0.05734 seconds to load)
2 examples, 1 failure
Failed examples:
rspec ./test_spec.rb:9 # SimpleDelegator composing match matcher does not work well for Delegator
Environment:
$ ruby -v
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-linux]
$ rspec -v
RSpec 3.13
- rspec-core 3.13.2
- rspec-expectations 3.13.3
- rspec-mocks 3.13.2
- rspec-support 3.13.2
Metadata
Metadata
Assignees
Labels
No labels