Sha256: 00c539819d772e425645df76b110e98c0f6afddac88e57120b45e5b7feca2eca

Contents?: true

Size: 1.32 KB

Versions: 34

Compression:

Stored size: 1.32 KB

Contents

require 'test_helper'

class PostsDataTests < Test::Unit::TestCase

  def setup
    @url = 'http://example.com'
    @gateway = SimpleTestGateway.new
  end
  
  def teardown
    SimpleTestGateway.retry_safe = false
  end
  
  def test_single_successful_post
    ActiveMerchant::Connection.any_instance.expects(:request).returns('')
    
    assert_nothing_raised do
      @gateway.ssl_post(@url, '') 
    end
  end
  
  def test_multiple_successful_posts
    ActiveMerchant::Connection.any_instance.expects(:request).times(2).returns('', '')
    
    assert_nothing_raised do
      @gateway.ssl_post(@url, '')
      @gateway.ssl_post(@url, '') 
    end
  end
    
  def test_setting_ssl_strict_outside_class_definition
    assert_equal SimpleTestGateway.ssl_strict, SubclassGateway.ssl_strict
    SimpleTestGateway.ssl_strict = !SimpleTestGateway.ssl_strict
    assert_equal SimpleTestGateway.ssl_strict, SubclassGateway.ssl_strict
  end

  def test_setting_timeouts
    @gateway.class.open_timeout = 50
    @gateway.class.read_timeout = 37
    ActiveMerchant::Connection.any_instance.expects(:request).returns('')
    ActiveMerchant::Connection.any_instance.expects(:open_timeout=).with(50)
    ActiveMerchant::Connection.any_instance.expects(:read_timeout=).with(37)

    assert_nothing_raised do
      @gateway.ssl_post(@url, '')
    end
  end
end

Version data entries

34 entries across 34 versions & 11 rubygems

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