Sha256: 38732302350b9640327f51e70e285fe3232b8c6c1ff888db3abf166e1f471fde

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 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
    AbtainBilling::Connection.any_instance.expects(:request).returns('')
    
    assert_nothing_raised do
      @gateway.ssl_post(@url, '') 
    end
  end
  
  def test_multiple_successful_posts
    AbtainBilling::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
    AbtainBilling::Connection.any_instance.expects(:request).returns('')
    AbtainBilling::Connection.any_instance.expects(:open_timeout=).with(50)
    AbtainBilling::Connection.any_instance.expects(:read_timeout=).with(37)

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abtain_billing-1.03 test/unit/posts_data_test.rb
abtain_billing-1.02 test/unit/posts_data_test.rb