collectiveidea / json_spec

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

JSON Path integration #85

Closed jstoup111 closed 7 years ago

jstoup111 commented 9 years ago

I'd really like the see a JSON Path integration. https://github.com/joshbuddy/jsonpath It seems awkward to me that a user would have to explicitly set their path to find data in the JSON string. Specifically, I'd like the run a test that that looks like something like this in cucumber

  Scenario: List events in JSON
    Given I oauth as the user "user1@test.com" with the password "password"
    When I GET to "v1/foos"
    Then the response status should be "200"
    And the JSON at "$..bar_type" should include ["baz", "biz"]

While I could explicitly write the code to test this for every property, it get's a little tedious after writing out every property and JSONPath provides a pretty slick powerful way to navigate the JSON to retrieve the data.

ryansch commented 9 years ago

Thanks for mentioning jsonpath here. I'm using to great effect now in my specs.

shekibobo commented 7 years ago

Hi there! We’re doing some open source maintenance work and closing old issues. If you would still like this issue to be addressed, please re-open it by May 17, 2017 or submit a pull-request at your convenience. Thanks!