Sha256: 7017b380e093be16b8046641b7e0c1717935bf4cfe9526d76eed3fea65c5cd16

Contents?: true

Size: 903 Bytes

Versions: 5

Compression:

Stored size: 903 Bytes

Contents

require 'test_helper'
require 'unit/response_stubs/find_transaction_stubs'

class FindTransactionTest < Test::Unit::TestCase

  include FindTransactionStubs

  def setup
    @environment = Spreedly::Environment.new("key", "secret")
  end

  def test_successful_find_transaction
    t = find_using(successful_get_transaction_response)

    assert_kind_of(Spreedly::AddPaymentMethod, t)
    assert_equal("2IFzBBh99rwjXKkZ0hkPVLjCBXL", t.token)
    assert_equal Time.parse("2013-08-05 19:32:49 UTC"), t.created_at
    assert_equal Time.parse("2013-08-05 19:32:49 UTC"), t.updated_at

    assert t.succeeded?
    assert_equal "Succeeded!", t.message
    assert_equal "7sqmBrh8zS4Mgei6wOyYskFpghF", t.payment_method.token
  end

  private
  def find_using(response)
    @environment.stubs(:raw_ssl_request).returns(response)
    @environment.find_transaction("IgnoredTokenSinceResponseIsStubbed")
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spreedly-2.0.4 test/unit/find_transaction_test.rb
spreedly-2.0.3 test/unit/find_transaction_test.rb
spreedly-2.0.2 test/unit/find_transaction_test.rb
spreedly-2.0.1 test/unit/find_transaction_test.rb
spreedly-2.0.0 test/unit/find_transaction_test.rb