Sha256: fa627a19b877541db44308a43a4578ce84655b017514d0c343229fe2a4d521e0

Contents?: true

Size: 927 Bytes

Versions: 6

Compression:

Stored size: 927 Bytes

Contents

require 'test_helper'

class CreditcardPaymentTest < ActiveSupport::TestCase
  fixtures :gateways, :gateway_configurations

  context "instance" do
    setup do
      @payment = Factory(:creditcard_payment)
      @auth_amount = @payment.authorization.amount
    end
    context "capture" do
      setup { @payment.capture }
      should_change("CreditcardTxn.count", :by => 1) { CreditcardTxn.count }
      should "create a capture transaction" do
        assert_equal CreditcardTxn::TxnType::CAPTURE, CreditcardTxn.last.txn_type
      end
      should_change("@payment.amount", :from => 0, :to => @auth_amount) { @payment.amount }
    end
    context "capture with no authorization" do
      setup do
        @payment.creditcard_txns = []
        @payment.capture
      end
      should_not_change("CreditcardTxn.count") { CreditcardTxn.count }
      should_not_change("@payment.amount") { @payment.amount }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 test/unit/creditcard_payment_test.rb
spree-0.9.4 test/unit/creditcard_payment_test.rb
spree-0.9.3 test/unit/creditcard_payment_test.rb
spree-0.9.2 test/unit/creditcard_payment_test.rb
spree-0.9.1 test/unit/creditcard_payment_test.rb
spree-0.9.0 test/unit/creditcard_payment_test.rb