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.5.27 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.26 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.45 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.25 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.23 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.44 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.22 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.43 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.21 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.42 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.20 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.41 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.19 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.40 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.18 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.39 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.17 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.38 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.5.16 test/view_models/workarea/storefront/refund_view_model_test.rb
workarea-storefront-3.4.37 test/view_models/workarea/storefront/refund_view_model_test.rb