Sha256: ff771649b0a00424857d190240541d6970ad4acfd7a4fcef2006bcc92d5364a0

Contents?: true

Size: 1.16 KB

Versions: 62

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

module Workarea
  class Payment
    class Capture
      class StoreCreditTest < TestCase
        def profile
          @profile ||= create_payment_profile(store_credit: 15.to_m)
        end

        def payment
          @payment ||= create_payment(profile: profile)
        end

        def tender
          @tender ||= begin
            payment.set_store_credit
            payment.store_credit
          end
        end

        def test_complete!
          transaction = tender.build_transaction(amount: 5.to_m)
          operation = StoreCredit.new(tender, transaction)

          operation.complete!

          assert(transaction.success?)
          assert_equal(
            ActiveMerchant::Billing::Response,
            transaction.response.class
          )
        end

        def test_cancel!
          transaction = tender.build_transaction(amount: 5.to_m)
          operation = StoreCredit.new(tender, transaction)

          operation.cancel!

          assert(transaction.success?)
          assert_equal(
            ActiveMerchant::Billing::Response,
            transaction.response.class
          )
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 test/models/workarea/payment/capture/store_credit_test.rb
workarea-core-3.4.12 test/models/workarea/payment/capture/store_credit_test.rb