Sha256: b7bd627c35b5b7e47db14135a87421c0939c25e5f66bac720f86852bea9e46e3
Contents?: true
Size: 1.43 KB
Versions: 12
Compression:
Stored size: 1.43 KB
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 def test_transaction_with_no_response t = find_using(responseless_transaction_response) assert_kind_of(Spreedly::Purchase, t) assert_equal("1f41avmBKchYCNam8rMgrRRTppD", t.token) assert !t.succeeded? assert_nil t.response end def test_add_payment_method_transaction_with_no_payment_method t = find_using(add_credit_card_transaction_sans_payment_method_method) assert_kind_of(Spreedly::AddPaymentMethod, t) assert_equal("rMyrUp27o11gA1pZu2SikMVRNIn", t.token) assert !t.succeeded? assert_nil t.payment_method end private def find_using(response) @environment.stubs(:raw_ssl_request).returns(response) @environment.find_transaction("IgnoredTokenSinceResponseIsStubbed") end end
Version data entries
12 entries across 12 versions & 1 rubygems