Payment failure testing for Ruby. Run MockCard's chaos scenarios against your webhook handler in CI,
assert what your app did, and guard production against MockCard's monitoring probes. Standard library
only. Rails apps: add mockcard-rails for the middleware, credentials and generator.
Author: Arixeva Labs hello@arixevalabs.com · mockcard.io · MIT
gem "mockcard", group: :testinclude MockCard::Assertions
run = MockCard::Runner.run_chaos(MockCard::Client.new,
project_id: "prj_…", target: "http://127.0.0.1:3000/webhooks/stripe",
assertions: { "duplicate" => { "order fulfilled once" => ->(_ctx) { Order.paid.count == 1 } } })
assert_chaos_run_passed(run)Works with the Pay gem: point target at Pay's webhook route.
if MockCard::Probe.probe?(request.headers) && MockCard::Probe.verify(request.headers, request.raw_post, ENV["MOCKCARD_PROBE_SECRET"])
response.set_header(MockCard::Probe::ACK_HEADER, "skipped")
return head :ok
endAPI reference: https://www.mockcard.io/openapi.yaml