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
is in the diff, despite "123" being matched by /2/ - this can make it harder to determine what the problem is, with a larger hash.
N.b. that the expected {:a => "123", :b => "foo"} to include {:b => "bar"} part of the failure message is good, and does indicate the problem - this issue is only about the "Diff:" part.
Your environment
Resolving dependencies...
Using bundler 1.17.3
Using diff-lcs 1.3
Using rspec-support 3.7.1
Using rspec-core 3.7.1
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Using rspec 3.7.0
Ruby version is: 2.5.3
Steps to reproduce
# frozen_string_literal: truebeginrequire"bundler/inline"rescueLoadError=>e
$stderr.puts"Bundler version 1.10 or later is required. Please update your Bundler"raiseeendgemfile(true)dosource"https://rubygems.org"gem"rspec","3.7.0"# Activate the gem and version you are reporting the issue against.endputs"Ruby version is: #{RUBY_VERSION}"require'rspec/autorun'RSpec.describe'includes'doitdoexpect({a: '123',b: 'foo',}).toinclude(a: /2/,b: 'bar')endend
Expected behavior
The diff does not highlight matched entries as different:
The issue here is that the differ diff-lcs diffs objects as strings, and the strings are different, thus this is the output we get. Improving this is something we'd very much like but theres no immediate bug fix here.
Expecting a hash to include another when using composable matchers gives a misleading diff for the subset of the hash that did match:
Notice that
is in the diff, despite
"123"
being matched by/2/
- this can make it harder to determine what the problem is, with a larger hash.N.b. that the
expected {:a => "123", :b => "foo"} to include {:b => "bar"}
part of the failure message is good, and does indicate the problem - this issue is only about the "Diff:" part.Your environment
Steps to reproduce
Expected behavior
The diff does not highlight matched entries as different:
Actual behavior
The diff does highlight matched entries as different:
The text was updated successfully, but these errors were encountered: