Sha256: 65e7181b482bc6c103e93b5eeaad84e324a673be272a3b903b2e0b39003ee3be

Contents?: true

Size: 1.22 KB

Versions: 62

Compression:

Stored size: 1.22 KB

Contents

require 'test_helper'

module Workarea
  class Payment
    class Tender
      class CreditCardTest < TestCase
        def profile
          @profile ||= create_payment_profile
        end

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

        def saved_card
          @saved_card ||= create_saved_credit_card(profile: profile)
        end

        def tender
          @tender ||= CreditCard.new(payment: payment, saved_card_id: saved_card.id)
        end

        def test_valid?
          tender.valid?

          assert_equal(saved_card.display_number, tender.display_number)
          assert_equal(saved_card.issuer, tender.issuer)
          assert_equal(saved_card.month, tender.month)
          assert_equal(saved_card.year, tender.year)
          assert_equal(saved_card.token, tender.token)

          saved_card.delete
          assert_nothing_raised { tender.valid? }
        end

        def test_saved?
          assert(tender.saved?)

          tender.saved_card_id = nil
          refute(tender.saved?)
        end

        def test_tokenized?
          assert(tender.tokenized?)

          tender.saved_card_id = nil
          refute(tender.tokenized?)
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.26 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.45 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.25 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.23 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.44 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.22 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.43 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.21 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.42 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.20 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.41 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.19 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.40 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.18 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.39 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.17 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.38 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.5.16 test/models/workarea/payment/tender/credit_card_test.rb
workarea-core-3.4.37 test/models/workarea/payment/tender/credit_card_test.rb