Sha256: 5076797dd41dca48c6903a52fce50fc0d01ce44556aef584c51e8551c6e0f5bb

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

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

class GetContactTest < Test::Unit::TestCase
  include IntegrationTestMethods
  
  def setup
    @gateway = XeroGateway::Gateway.new(
      :customer_key => CUSTOMER_KEY,
      :api_key => API_KEY    
    )
    
    if STUB_XERO_CALLS
      @gateway.xero_url = "DUMMY_URL"
      
      @gateway.stubs(:http_get).with {|url, params| url =~ /contact$/ }.returns(get_file_as_string("contact.xml"))          
      @gateway.stubs(:http_put).with {|url, body, params| url =~ /contact$/ }.returns(get_file_as_string("contact.xml"))          
    end
  end
  
  def test_get_contact
    # Make sure there is an contact in Xero to retrieve
    contact = @gateway.create_contact(dummy_contact).contact
    flunk "get_contact could not be tested because create_contact failed" if contact.nil?

    result = @gateway.get_contact_by_id(contact.contact_id)
    assert result.success?
    assert_equal result.contact.name, contact.name
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tlconnor-xero_gateway-1.0.2 test/integration/get_contact_test.rb