Comments (6)
👍 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.
expect_only_json( public: 'here' )
expect_only_json( {public: 'here'}, ignore: ['date', 'time'] )
from airborne.
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.
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.
Thanks for the reference! I'll check it out as well :)
from airborne.
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:
- That all keys in the expected hash are in the response.
- 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)
- GET from test environment HOT 1
- How to set verify_ssl => false HOT 4
- Faraday Response support HOT 1
- Potential incompatibility with RSpec 3.5.4 HOT 7
- Routing error with post action
- Ruby 2.4 warnings HOT 2
- Is there a way to test for the absence of data? HOT 9
- ARRAY: Api request returned invalid json (Airborne::InvalidJsonError) HOT 6
- Argument error when making POST requests HOT 2
- Looking for Project Maintainers HOT 13
- : (
- Bug: expect_json_sizes with * don't work as expected
- JSON array body instead of hash body in POST/PUT
- Why header keys are downcased? HOT 1
- Is it possible to use on a non-request spec?
- is it possible to use 'Content_Type' => 'application/xml'
- Rails 5.1.5 compatibilty HOT 1
- Is this project dead? HOT 17
- PUT request with no request_body and error messaging issue HOT 1
- Not working with rails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airborne.