zinc-collective / compensated

Create value. Get Paid.
Other
13 stars 1 forks source link

fixed a couple instances of mangled json #78

Closed ghost closed 4 years ago

ghost commented 4 years ago

Not sure what the cause of this was, but alas, an easy fix

zspencer commented 4 years ago

Ahhh, that is because the JSON files are erb fixtures, not plain old json. They should be named <filename>.json.erb so that it's a bit more clear that they are intended for data to be interpolatable into them.

See:

You can use the compensated_event_body method defined in the Compensated::Spec::Helpers module to interpolate your own values into the JSON like so:

$ bundle console
> require 'json'
> include Compensated::Spec::Helpers
# => Object
> puts JSON.parse(compensated_event_body('stripe/charge.succeeded.api-v2014-11-05.json'))

You can see examples of this in the feature definition for using fixutres, and there is corresponding code illustrating it in the underying step definitions

ghost commented 4 years ago

Ahh I see. Shall I close this issue and make a PR to rename the files?

zspencer commented 4 years ago

@lanegrant that'd be awesome! Thank you!