Sha256: 93012ce8ed39737a730e2cf69269ffb370ceb9ce278ece782e7fe4f58be1a75d

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

require File.dirname(__FILE__) + '/../../test_helper'

class Gateway < Test::Unit::TestCase
 def test_should_detect_if_a_card_is_supported
    Gateway.supported_cardtypes = [:visa, :bogus]
    assert [:visa, :bogus].all? { |supported_cardtype| Gateway.supports?(supported_cardtype) }
    
    Gateway.supported_cardtypes = []
    assert_false [:visa, :bogus].all? { |invalid_cardtype| Gateway.supports?(invalid_cardtype) }
  end
  
  def test_should_gateway_uses_ssl_strict_checking_by_default
    assert Gateway.ssl_strict
  end
  
  def test_should_be_able_to_look_for_test_mode
    Base.gateway_mode = :test
    assert Gateway.new.test?
    
    Base.gateway_mode = :production
    assert_false Gateway.new.test?
  end
  
  def test_amount_style
   assert_equal '10.34', Gateway.new.send(:amount, 1034)

   assert_raise(ArgumentError) do
     Gateway.new.send(:amount, '10.34')
   end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activemerchant-1.3.0 test/unit/gateways/gateway_test.rb
activemerchant-1.3.1 test/unit/gateways/gateway_test.rb