Sha256: 679730e178b9fac16d43cbd3da0caa5c8a2e4c2d6b90e52bff78c096044d09c7

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

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

class GetContactsTest < Test::Unit::TestCase
  include TestHelper
  
  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 =~ /contacts$/ }.returns(get_file_as_string("contacts.xml"))          
      @gateway.stubs(:http_put).with {|url, body, params| url =~ /contact$/ }.returns(get_file_as_string("contact.xml"))          
    end
  end
  
  def test_get_contacts
    # Make sure there is an contact in Xero to retrieve
    contact = @gateway.create_contact(dummy_contact).contact
    flunk "get_contacts could not be tested because create_contact failed" if contact.nil?

    result = @gateway.get_contacts
    assert result.success?
    assert !result.request_params.nil?
    assert !result.response_xml.nil?
    assert result.contacts.collect {|c| c.contact_id}.include?(contact.contact_id)
  end  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tlconnor-xero_gateway-1.0.3 test/integration/get_contacts_test.rb
tlconnor-xero_gateway-1.0.4 test/integration/get_contacts_test.rb