Giter VIP home page Giter VIP logo

Comments (6)

kennycason avatar kennycason commented on August 22, 2024

👍 I would like to have both options. (Minor disagreement on naming)
e.g.

# only match specific values, don't care about other values.
expect_json({public: 'here'})  
# match every key and every value, strictly. 
expect_json_exact({public: 'here', secret: 'there'})   

from airborne.

kswope avatar kswope commented on August 22, 2024
expect_only_json( public: 'here' )  
expect_only_json( {public: 'here'}, ignore: ['date', 'time'] )  

from airborne.

kennycason avatar kennycason commented on August 22, 2024

I think that's just as verbose as you end up having to specify what you ignore, which could be a lot depending on the test. I think i'd rather just have two methods. One that matches all values, exactly, and one that acts as a whitelist and only matches/verifies the specified fields.

I know that having expect_json now validate ALL fields like it does in version 16 was enough to prevent me from upgrading as we have a lot of tests that are testing very specific fields during testing large responses.

from airborne.

kswope avatar kswope commented on August 22, 2024

I didn't know a previous version already did what I'm asking for, I'm sorry to hear that. I think I'll just try combining airborne with https://github.com/collectiveidea/json_spec since it seems to have a better thought out functionality. Not sure if they'll play nicely together yet.

from airborne.

kennycason avatar kennycason commented on August 22, 2024

Thanks for the reference! I'll check it out as well :)

from airborne.

sethpollack avatar sethpollack commented on August 22, 2024

The plan is to add options which can be configured in the Airborne.configure block or passed into individual tests.

The options will allow you to test:

  1. That all keys in the expected hash are in the response.
  2. That all keys in the response are in the expected hash.

So if you only want to check the keys that are in both, you can turn both these options off.

from airborne.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.