Sha256: c30e0a3cbec39e2a26f3b7c06b0378d54f12fa2b5bc4759a377c053bc1c96bfa

Contents?: true

Size: 769 Bytes

Versions: 62

Compression:

Stored size: 769 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class RefundViewModelTest < TestCase
      def test_tenders
        order = create_placed_order
        payment = Payment.find(order.id)
        amounts = payment.tenders.reduce({}) { |m, t| m.merge(t.id => t.amount) }

        Payment::Capture.new(payment: payment, amounts: amounts).complete!
        refund = Payment::Refund
                  .new(payment: payment, amounts: amounts)
                  .tap(&:complete!)

        view_model = RefundViewModel.wrap(refund)
        assert_equal(1, view_model.tenders.size)
        assert_equal(payment.credit_card, view_model.tenders.keys.first)
        assert_equal(payment.credit_card.amount, view_model.tenders.values.first)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.4 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.26 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.3 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.25 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.2 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.24 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.1 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.23 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.22 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.0 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.21 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.0.beta.1 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.20 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.19 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.18 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.17 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.16 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.15 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.14 test/view_models/workarea/storefront/refund_view_model_test.rb