collectiveidea / json_spec

Easily handle JSON in RSpec and Cucumber
rubygems.org/gems/json_spec
MIT License
919 stars 114 forks source link

include_json doesn't work for simple caser #87

Closed ArpiJakab closed 7 years ago

ArpiJakab commented 9 years ago

using it with RSpec expect({:make => "Acura"}.to_json).to include_json({:make => "Acura"}.to_json)

I get error: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rspec-support-3.3.0/lib/rspec/support.rb: 86:in `block in module:Support': Expected {"make":"Acura"} to include {"make": "Acura"} (RSpec::Expectations::ExpectationNotMetError)

am I doing something wrong?

shekibobo commented 7 years ago

The behavior for include_json will match elements that are descendants of the main JSON object, but it does not support matching itself. To check the equality of two JSON objects, use be_json_eql instead.