Sha256: 9c2978c6be2d5c89a36d004f013c792f2e21309a656808d1f22e5d07a4e3fe7f

Contents?: true

Size: 1 KB

Versions: 34

Compression:

Stored size: 1 KB

Contents

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

class GetContactTest < 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 =~ /Contacts\/[^\/]+$/ }.returns(get_file_as_string("contact.xml"))          
      @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /Contacts$/ }.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 !result.request_params.nil?
    assert !result.response_xml.nil?
    assert_equal result.contact.name, contact.name
  end
end

Version data entries

34 entries across 34 versions & 3 rubygems

Version Path
xero_gateway-2.0.15 test/integration/get_contact_test.rb
xero_gateway-2.0.14 test/integration/get_contact_test.rb
xero_gateway-2.0.13 test/integration/get_contact_test.rb
xero_gateway-2.0.12 test/integration/get_contact_test.rb
xero_gateway-2.0.11 test/integration/get_contact_test.rb
xero_gateway-2.0.10 test/integration/get_contact_test.rb
xero_gateway-2.0.9 test/integration/get_contact_test.rb
xero_gateway-2.0.8 test/integration/get_contact_test.rb
xero_gateway-2.0.7 test/integration/get_contact_test.rb
xero_gateway-2.0.6 test/integration/get_contact_test.rb
xero_gateway-2.0.5 test/integration/get_contact_test.rb
xero_gateway-2.0.4 test/integration/get_contact_test.rb
xero_gateway-2.0.3 test/integration/get_contact_test.rb
xero_gateway-2.0.2 test/integration/get_contact_test.rb