json_spec icon indicating copy to clipboard operation
json_spec copied to clipboard

JSON should include_json does not work

Open ngonzalez opened this issue 7 years ago • 2 comments

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

ngonzalez avatar Dec 11 '17 12:12 ngonzalez

+1

ryanoboril avatar Jan 03 '18 20:01 ryanoboril

Same here. Running:

  • Ruby 2.5.1
  • multi_json (1.13.1)
  • json_spec (1.1.5)

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

frodera avatar Apr 30 '18 02:04 frodera