Sha256: f6d450d2884230f517cc1b05ff4d49c784d2e2cea5d78ea59fecc9d484f7119c
Contents?: true
Size: 833 Bytes
Versions: 6
Compression:
Stored size: 833 Bytes
Contents
require "spec_helper" describe JsonSpec::Matchers::HaveJsonPath do it "matches hash keys" do %({"one":{"two":{"three":4}}}).should have_json_path("one/two/three") end it "doesn't match values" do %({"one":{"two":{"three":4}}}).should_not have_json_path("one/two/three/4") end it "matches array indexes" do %([1,[1,2,[1,2,3,4]]]).should have_json_path("1/2/3") end it "respects null array values" do %([null,[null,null,[null,null,null,null]]]).should have_json_path("1/2/3") end it "matches hash keys and array indexes" do %({"one":[1,2,{"three":4}]}).should have_json_path("one/2/three") end it "provides a description message" do matcher = have_json_path("json") matcher.matches?(%({"id":1,"json":"spec"})) matcher.description.should == %(have JSON path "json") end end
Version data entries
6 entries across 6 versions & 1 rubygems