Skip to content

Conversation

alvesoaj
Copy link

@alvesoaj alvesoaj commented Aug 30, 2019

I made this gem allow accept an optional second param on its match

def match_snapshot(snapshot_name, json_structure_only = false)
  MatchSnapShot.new(self.class.metadata, snapshot_name, json_structure_only)
end

it makes the match check only the structure of JSON object to ensure if the actual and expected have the same structure keys and same kind of object on its value.

It is really useful for me, I use Faker to create my tests and with this I don't care with the values itself but just only if my API is getting the same data structure.

I hope it is useful for more people.

@alvesoaj
Copy link
Author

alvesoaj commented Aug 30, 2019

A good idea is create a new match, to make this stuff clear, instead of have only match_snapshot with an optional param, we can have another match called for example: match_deep_json_snapshot or match_json_structure_snapshot. What do you think guys?

@levinmr
Copy link
Owner

levinmr commented Jun 21, 2021

Needs rebased

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants