You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classFoo;endRSpec.describe"Using `array_including(instance_of(Foo))`"doit"passes when the args match"dodbl=doubleexpect(dbl).toreceive(:a_message).with(3,array_including(instance_of(Foo)))dbl.a_message(3,[1,Foo.new,4])endend
It fails:
1) Using `array_including(instance_of(Foo))` passes when the args match
Failure/Error: dbl.a_message(3, [1, Foo.new, 4])
Double received :a_message with unexpected arguments
expected: (3, array_including(#<RSpec::Mocks::ArgumentMatchers::InstanceOf:0x007f8eaaaa8710>))
got: (3, [1, #<Foo:0x007f8eaaa50e48>, 4])
# ./lib/rspec/mocks/error_generator.rb:213:in `__raise'
# ./lib/rspec/mocks/error_generator.rb:43:in `raise_unexpected_message_args_error'
# ./lib/rspec/mocks/proxy.rb:193:in `raise_unexpected_message_args_error'
# ./lib/rspec/mocks/proxy.rb:174:in `message_received'
# ./lib/rspec/mocks/method_double.rb:73:in `proxy_method_invoked'
# ./lib/rspec/mocks/method_double.rb:60:in `block (2 levels) in define_proxy_method'
# ./spec/array_including_example_spec.rb:7:in `block (2 levels) in <top (required)>'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example.rb:166:in `instance_exec'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example.rb:166:in `block in run'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example.rb:344:in `with_around_example_hooks'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example.rb:163:in `run'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example_group.rb:494:in `block in run_examples'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example_group.rb:490:in `map'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example_group.rb:490:in `run_examples'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/example_group.rb:456:in `run'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:112:in `block (2 levels) in run_specs'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:112:in `map'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/reporter.rb:62:in `report'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:108:in `run_specs'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:86:in `run'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:70:in `run'
# /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/runner.rb:38:in `invoke'
# /Users/myron/code/rspec-dev/repos/rspec-core/exe/rspec:4:in `<top (required)>'
# ./bin/rspec:16:in `load'
# ./bin/rspec:16:in `<main>'
Finished in 0.00813 seconds (files took 0.13108 seconds to load)
1 example, 1 failure
The problem is that array_including doesn't delegate to RSpec::Support::FuzzyMatcher.values_match? to match individual array elements. This is a bug. Also, the description doesn't look right -- it should use the description of the composed matchers. Actually, looking at argument_matchers.rb, this looks like a problem with the hash matchers, too.
One potential fix is the solution to #513 being discussed there, as the rspec-expectations versions of these matchers already work properly for these cases.
The text was updated successfully, but these errors were encountered:
As reported in a tweet:
https://twitter.com/fuzzmonkey/status/524271331349921792
Given this spec:
It fails:
The problem is that
array_including
doesn't delegate toRSpec::Support::FuzzyMatcher.values_match?
to match individual array elements. This is a bug. Also, thedescription
doesn't look right -- it should use the description of the composed matchers. Actually, looking atargument_matchers.rb
, this looks like a problem with the hash matchers, too.One potential fix is the solution to #513 being discussed there, as the rspec-expectations versions of these matchers already work properly for these cases.
The text was updated successfully, but these errors were encountered: