Sha256: 60f58e44e8b2a422a82889f8045131fdba45904c12dffa0d74ef803c133f76e9
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require 'test_helper' module Workarea class Checkout class ForterCollectPaymentTest < TestCase setup :create_models def test_purchase @collect_payment.purchase @order.reload forter_decision = @order.fraud_decision assert_equal(1, forter_decision.responses.size) assert_equal(:approve, forter_decision.decision) end def test_rescuing_timeout_errors Workarea::Forter::BogusGateway .any_instance .stubs(:create_decision) .raises(Faraday::Error::TimeoutError) refute(@collect_payment.purchase) @order.reload forter_decision = @order.fraud_decision assert_equal(:no_decision, forter_decision.decision) assert_equal("An error occured during the fraud check: timeout", forter_decision.message) end private def create_models @order = Order.create!(email: 'test@workarea.com', total_price: 5.to_m) @checkout = Checkout.new(@order) @payment = Payment.create!( id: @order.id, address: { first_name: "Ben", last_name: "Crouse", street: "22 S 3rd St", city: "Philadelphia", region: "PA", country: Country['US'], postal_code: 19106 } ) @collect_payment = CollectPayment.new(@checkout) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems