Sha256: 3373ae27249505bcf3b9007ed1cf20ec7ac6083275c25da1c7af27e207070df6
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
require 'test_helper' class RemoteUpdateCreditCardTest < Test::Unit::TestCase def setup @environment = Spreedly::Environment.new(remote_test_environment_key, remote_test_access_secret) end def test_invalid_login assert_invalid_login do |environment| environment.update_credit_card("card_token", card_deets) end end def test_non_existent_card_token assert_raise_with_message(Spreedly::NotFoundError, "Unable to find the specified payment method.") do @environment.update_credit_card('unknown_card', card_deets) end end def test_failed_with_validation_errors card = create_card_on(@environment) error = assert_raises(Spreedly::TransactionCreationError) do @environment.update_credit_card(card.token, card_deets(last_name: '', first_name: ' ')) end expected_errors = [ { attribute: "first_name", key: "errors.blank", message: "First name can't be blank" }, { attribute: "last_name", key: "errors.blank", message: "Last name can't be blank" } ] assert_equal expected_errors, error.errors assert_equal "First name can't be blank\nLast name can't be blank", error.message end def test_successful_update_card card = create_card_on(@environment) result = @environment.update_credit_card(card.token, card_deets) assert_kind_of(Spreedly::CreditCard, result) assert_equal 'Cauthon', result.last_name assert_equal 'Mat', result.first_name assert_equal 'cauthon@wot.com', result.email assert_equal false, result.eligible_for_card_updater end private def card_deets(options = {}) { email: 'cauthon@wot.com', month: 1, year: 2019, last_name: 'Cauthon', first_name: 'Mat', eligible_for_card_updater: 'false' }.merge(options) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spreedly-2.0.15 | test/remote/remote_update_credit_card_test.rb |
spreedly-2.0.14 | test/remote/remote_update_credit_card_test.rb |
spreedly-2.0.13 | test/remote/remote_update_credit_card_test.rb |