Sha256: d58e4c22b63370811a9d3951b463202fcb5508c69631a382c38fb64b8586ab12

Contents?: true

Size: 1.68 KB

Versions: 10

Compression:

Stored size: 1.68 KB

Contents

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

class BaseTest < Test::Unit::TestCase
  def setup
    ActiveMerchant::Billing::Base.mode = :test
  end
  
  def teardown
    ActiveMerchant::Billing::Base.mode = :test
  end
  
  def test_should_return_a_new_gateway_specified_by_symbol_name
    assert_equal BogusGateway,         Base.gateway(:bogus)
    assert_equal MonerisGateway,       Base.gateway(:moneris) 
    assert_equal AuthorizeNetGateway,  Base.gateway(:authorize_net)
    assert_equal UsaEpayGateway,       Base.gateway(:usa_epay)
    assert_equal LinkpointGateway,     Base.gateway(:linkpoint)
    assert_equal AuthorizedNetGateway, Base.gateway(:authorized_net)
  end

  def test_should_return_an_integration_by_name
    chronopay = Base.integration(:chronopay)
    
    assert_equal Integrations::Chronopay, chronopay
    assert_instance_of Integrations::Chronopay::Notification, chronopay.notification('name=cody')
  end

  def test_should_set_modes
    Base.mode = :test
    assert_equal :test, Base.mode
    assert_equal :test, Base.gateway_mode
    assert_equal :test, Base.integration_mode

    Base.mode = :production
    assert_equal :production, Base.mode
    assert_equal :production, Base.gateway_mode
    assert_equal :production, Base.integration_mode

    Base.mode             = :development
    Base.gateway_mode     = :test
    Base.integration_mode = :staging
    assert_equal :development, Base.mode
    assert_equal :test,        Base.gateway_mode
    assert_equal :staging,     Base.integration_mode
  end
  
  def test_should_identify_if_test_mode
    Base.gateway_mode = :test
    assert Base.test?
    
    Base.gateway_mode = :production
    assert_false Base.test?
  end

end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
martinstannard-activemerchant-0.1.0 test/unit/base_test.rb
seamusabshere-active_merchant-1.4.2.1 test/unit/base_test.rb
seamusabshere-active_merchant-1.4.2.3 test/unit/base_test.rb
activemerchant-1.4.0 test/unit/base_test.rb
activemerchant-1.3.0 test/unit/base_test.rb
activemerchant-1.4.1 test/unit/base_test.rb
activemerchant-1.3.2 test/unit/base_test.rb
activemerchant-1.3.1 test/unit/base_test.rb
activemerchant-1.4.2 test/unit/base_test.rb
spree-0.2.0 vendor/plugins/active_merchant/test/unit/base_test.rb