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
If you use an Rspec matcher inside a hash, and there is something wrong with the hash, even if the matcher was correct, the ObjectInspector inspects the matcher before passing it to the differ, and then as a result, tells you that they didn't match.
require'spec_helper'describe'issue with the new ObjectInspector'dolet(:expectation)do{decimal: 0.000005,string: 'word',}endit'outputs correctly'doexpect(expectation).tomatch(decimal: be_within(0.1).of(0.000004),string: 'word',)endit'outputs weirdly'doexpect(expectation).tomatch(decimal: be_within(0.1).of(0.000004),string: 'wordx',)endend
# Run options: exclude {:skip=>true}## 1) issue with the new ObjectInspector outputs weirdly# Failure/Error: expect(expectation).to match(# expected {:decimal=>5.0e-06, :string=>"word"} to match {:decimal=>(be within 0.1 of 4.0e-06), :string=>"wordx"}# Diff:# @@ -1,3 +1,3 @@# -:decimal => (be within 0.1 of 4.0e-06),# -:string => "wordx",# +:decimal => 5.0e-06,# +:string => "word",## # ./example-breaking.rb:19:in `block (2 levels) in <top (required)>'## 2/2 |============================================================ 100 ============================================================>| Time: 00:00:00## Finished in 0.60996 seconds (files took 6.8 seconds to load)#2 examples, 1 failure## Failed examples:## rspec ./example-breaking.rb:18 # issue with the new ObjectInspector outputs weirdly
The text was updated successfully, but these errors were encountered:
hackling
changed the title
Bug: Issue with Differ due to new ObjectInspector class
Bug: Issue with Differ due to new ObjectFormatter class
Jul 10, 2015
Yep, this is a known issue. There's some prior discussion about it in rspec/rspec-expectations#495. Given that we're doing a simple textual diff, I'm not sure what the solution is. Any ideas?
It would have to involve something like evaluating the composed matcher, and then if it evaluates to true, maybe override the content of the hashes so that it doesn't trigger the differ.
If you use an Rspec matcher inside a hash, and there is something wrong with the hash, even if the matcher was correct, the ObjectInspector inspects the matcher before passing it to the differ, and then as a result, tells you that they didn't match.
The text was updated successfully, but these errors were encountered: