We've moved discussions to Discord

What's the correct way to test Pay::Charge #receipt and #invoice?

Josh Frankel
I'm working through increasing test coverage throughout our application and ran across the Pay::Charge#receipt and Pay::Charge#invoice methods within ChargesController. I see Jumpstart is using the receipts gem (https://github.com/excid3/receipts) but am having a disconnect between how the pay gem and receipts function together in order to properly test the two. 

Currently, `@charge.receipt` and `@charge.invoice` produce a `KeyError: key not found: :details` error making me thinking I'm missing the receipt details key. Any guidance or tips here would be much appreciated. Thanks

EDIT: So far I have the super ugly format that works but makes me nervous about thread-safety
Pay::Charge.any_instance.stubs(:receipt).returns("foobarbaz")
get charge_path(pay_charges(:charge_1), format: :pdf)

Richie Khoo
^ The website listed is super super shiny I'll admit. But I'm pretty sure this is a spam/bot message.
Josh Frankel
I'm working through increasing test coverage throughout our application and ran across the Pay::Charge#receipt and Pay::Charge#invoice methods within ChargesController. I see Jumpstart is using the receipts gem (https://github.com/excid3/receipts) but am having a disconnect between how the pay gem and receipts function together in order to properly test the two. 

Currently, `@charge.receipt` and `@charge.invoice` produce a `KeyError: key not found: :details` error making me thinking I'm missing the receipt details key. Any guidance or tips here would be much appreciated. Thanks

EDIT: So far I have the super ugly format that works but makes me nervous about thread-safety
Pay::Charge.any_instance.stubs(:receipt).returns("foobarbaz")
get charge_path(pay_charges(:charge_1), format: :pdf)

Richie Khoo
^ The website listed is super super shiny I'll admit. But I'm pretty sure this is a spam/bot message.
Notifications
You’re not receiving notifications from this thread.
© 2022 Jumpstart Pro by GoRails, LLC