Sha256: 113252b51c65dfc6b80b5231747ed4ad263239670f403ea01a702952fc3af67e
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'test_helper' module Workarea class Checkout class CollectPaymentTest < TestCase def order @order ||= Order.new(email: 'test@workarea.com', total_price: 5.to_m) end def checkout @checkout ||= Checkout.new(order) end def collect_payment @collect_payment ||= CollectPayment.new(checkout) end def test_valid? refute(collect_payment.valid?) assert_equal(1, checkout.payment.errors[:base].length) end def test_purchase refute(collect_payment.purchase) order.total_price = 0.to_m assert(collect_payment.purchase) order.total_price = 5.to_m checkout.payment.profile = create_payment_profile( email: order.email, store_credit: 20.to_m ) checkout.payment.build_store_credit(amount: 5.to_m) assert(collect_payment.purchase) end def test_action Workarea.config.checkout_payment_action = { not_shipped: 'foo!', shipped: 'bar!', mixed: 'baz!' } order.items.build(requires_shipping: false) assert_equal('foo!', collect_payment.action) order.items.build(requires_shipping: true) assert_equal('baz!', collect_payment.action) order.items.clear order.items.build(requires_shipping: true) assert_equal('bar!', collect_payment.action) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
workarea-core-3.5.0.beta.1 | test/models/workarea/checkout/collect_payment_test.rb |