Sha256: cd6b6c34df634b5210755494b087abaa844c711024b74075790b525a82384a1b

Contents?: true

Size: 1.34 KB

Versions: 22

Compression:

Stored size: 1.34 KB

Contents

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

class CreateBankTransactionTest < 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_put).with {|client, url, body, params| url =~ /BankTransactions$/ }.returns(get_file_as_string("create_bank_transaction.xml"))
      @gateway.stubs(:http_post).with {|client, url, body, params| url =~ /BankTransactions$/ }.returns(get_file_as_string("bank_transaction.xml"))
    end
  end

  def test_create_bank_transaction
    example_bank_transaction = create_test_bank_transaction.dup

    result = @gateway.create_bank_transaction(example_bank_transaction)
    assert_kind_of XeroGateway::Response, result
    assert result.success?
    assert !result.request_xml.nil?
    assert !result.response_xml.nil?
    assert !result.bank_transaction.bank_transaction_id.nil?
    assert example_bank_transaction.bank_transaction_id =~ GUID_REGEX
  end

  def test_create_bank_transaction_valid
    example_bank_transaction = create_test_bank_transaction.dup
    assert_equal true, example_bank_transaction.valid?,
      "bank_transaction is invalid - errors:\n\t#{example_bank_transaction.errors.map { | error | "#{error[0]} #{error[1]}"}.join("\n\t")}"
  end

  private


end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
xero_gateway-2.7.0 test/integration/create_bank_transaction_test.rb
xero_gateway-2.6.0 test/integration/create_bank_transaction_test.rb
xero_gateway-2.5.0 test/integration/create_bank_transaction_test.rb
xero_gateway-2.4.0 test/integration/create_bank_transaction_test.rb
xero_gateway-2.3.0 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.1.7 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.1.6 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.1.4 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.1.3 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.1.1 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.0.18 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.0.17 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.0.16 test/integration/create_bank_transaction_test.rb
xero_gateway-float-2.0.15 test/integration/create_bank_transaction_test.rb
xero_gateway-2.1.0 test/integration/create_bank_transaction_test.rb
xero_gateway-n8vision-2.0.20 test/integration/create_bank_transaction_test.rb
xero_gateway-2.0.19 test/integration/create_bank_transaction_test.rb
xero_gateway-2.0.18 test/integration/create_bank_transaction_test.rb
xero_gateway-2.0.17 test/integration/create_bank_transaction_test.rb
xero_gateway-2.0.16 test/integration/create_bank_transaction_test.rb