Sha256: 024063067a5fb7624bca28d76042be62c3396572c0ae1a89fa895d54e1f96ddb

Contents?: true

Size: 911 Bytes

Versions: 36

Compression:

Stored size: 911 Bytes

Contents

require 'test_helper'

class ExpiryDateTest < Test::Unit::TestCase
  def test_should_be_expired
    last_month = 2.months.ago
    date = CreditCard::ExpiryDate.new(last_month.month, last_month.year)
    assert date.expired?
  end
  
  def test_today_should_not_be_expired
    today = Time.now.utc
    date = CreditCard::ExpiryDate.new(today.month, today.year)
    assert_false date.expired?
  end
  
  def test_dates_in_the_future_should_not_be_expired
    next_month = 1.month.from_now
    date = CreditCard::ExpiryDate.new(next_month.month, next_month.year)
    assert_false date.expired?
  end
  
  def test_invalid_date
    expiry = CreditCard::ExpiryDate.new(13, 2009)
    assert_equal Time.at(0).utc, expiry.expiration
  end
  
  def test_month_and_year_coerced_to_integer
    expiry = CreditCard::ExpiryDate.new("13", "2009")
    assert_equal 13, expiry.month
    assert_equal 2009, expiry.year
  end
end

Version data entries

36 entries across 36 versions & 12 rubygems

Version Path
johnideal-activemerchant-1.4.10 test/unit/expiry_date_test.rb
johnideal-activemerchant-1.4.11 test/unit/expiry_date_test.rb
johnideal-activemerchant-1.4.4 test/unit/expiry_date_test.rb
johnideal-activemerchant-1.4.5 test/unit/expiry_date_test.rb
johnideal-activemerchant-1.4.6 test/unit/expiry_date_test.rb
johnideal-activemerchant-1.4.7 test/unit/expiry_date_test.rb
johnideal-activemerchant-1.4.8 test/unit/expiry_date_test.rb
mattbauer-activemerchant-1.4.2 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.4 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.5 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.6 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.7 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.8 test/unit/expiry_date_test.rb
tomriley-tomriley-active_merchant-1.4.2.4 test/unit/expiry_date_test.rb
am_credit_card-0.0.1 test/unit/expiry_date_test.rb
goldstar-activemerchant-1.4.2.7 test/unit/expiry_date_test.rb
goldstar-activemerchant-1.4.2.6 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.11 test/unit/expiry_date_test.rb
tomriley-active_merchant-1.4.2.10 test/unit/expiry_date_test.rb
smulube-activemerchant-1.5.1.4 test/unit/expiry_date_test.rb