collectiveidea / json_spec

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

JSON should include_json does not work #101

Open ngonzalez opened 6 years ago

ngonzalez commented 6 years ago

With json_spec 1.1.5 and the following test:

  it "matches json content with path" do
    json = %({"item": {"id": "1"}})
    json.should include_json(%({"id": "1"})).at_path("item")
  end
Failures:

  1) JsonSpec::Matchers::IncludeJson matches json content
     Failure/Error: json.should include_json(%({"id": "1"})).at_path("item")
       Expected {"item": {"id":"1" }} to include {"id": "1"} at path "item"
     # ./spec/json_spec/matchers/include_json_spec.rb:44:in `block (2 levels) in <top (required)>'

Finished in 0.07838 seconds (files took 0.16929 seconds to load)
116 examples, 1 failure

Failed examples:

rspec ./spec/json_spec/matchers/include_json_spec.rb:42 # JsonSpec::Matchers::IncludeJson matches json content
ryanoboril commented 6 years ago

+1

frodera commented 6 years ago

Same here. Running:

Edit: Per include_json_spec.rb that seems to be the intended behavior. 😕