Sha256: 7d4e9753b2cff333daf35874265ddca5fce132443cd35d4306d469028f6bf1ff

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

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

class GetPaymentsTest < Test::Unit::TestCase
  include TestHelper
  
  def setup
    @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
    
    if STUB_XERO_CALLS
      @gateway.xero_url = "DUMMY_URL"
      
      @gateway.stubs(:http_get).with {|client, url, params| url =~ /Payments$/ }.returns(get_file_as_string("payments.xml"))          
    end
  end
  
  def test_get_payments
    result = @gateway.get_payments
    assert result.success?
    assert !result.request_params.nil?
    assert !result.response_xml.nil?
    assert result.payments.length == 57
    assert result.payments.collect {|c| c.payment_id}.include?("4c955477-b582-4d5e-898a-86fa14e461fb")
  end  
  
  # Make sure that a reference to gateway is passed when the get_contacts response is parsed.
  def test_get_payments_gateway_reference
    result = @gateway.get_payments
    assert(result.success?)
    assert_not_equal(0, result.payments.size)
    
    result.payments.each do | payment |
      assert(payment.gateway === @gateway)
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xero_gateway-float-2.1.7 test/integration/get_payments_test.rb
xero_gateway-float-2.1.6 test/integration/get_payments_test.rb
xero_gateway-float-2.1.4 test/integration/get_payments_test.rb