zinc-collective / compensated

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

🌱🎉Sprout compensated-spec project for fixtures #72

Closed zspencer closed 4 years ago

zspencer commented 4 years ago

One of the big challenges for working with using compensated is a lack of clarity on what the actual data structure coming out will look like.

This gives client developers a tool to programmatically verify their implementation by firing raw events from payment processors through their compensated implementation.

See: https://github.com/zinc-collective/compensated/issues/68

zspencer commented 4 years ago

@user512 / @lanegrant - Does this look like it's a "good enough" step to consider merging so that we can move forward piece-by-piece on the specification? I want to make sure we're integrating the work we do on the regular so that it's easy to build on top of one anothers work, but I also don't want to put something into the repo if it's just going to get in the way.

Thoughts?

zspencer commented 4 years ago

Phew! I think I got this working!

Essentially you can mixin Compensated::Spec::Helpers into your test suite, and then you can call the methods defined on it to generate fake requests, event body payloads, etc; and replace data within them using the JsonSpec syntax.

This should make it much easier for folks to write tests for their compensated integration.

@lanegrant / @user512 - Mind giving this a review? The fixture files themselves aren't particularly interesting.