Sha256: 06565da2cca2744140def653e2ab78d4e3a25d22b942ac5bb0d319a0d8a84d0d

Contents?: true

Size: 1.21 KB

Versions: 28

Compression:

Stored size: 1.21 KB

Contents

require 'test_helper'

class RemoteRetainTest < 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.retain_payment_method('payment_method_token')
    end
  end

  def test_payment_method_token_token_not_found
    assert_raise_with_message(Spreedly::NotFoundError, "Unable to find the specified payment method.") do
      @environment.retain_payment_method('unknown_token')
    end
  end

  def test_successful_retain
    card_token = create_card_on(@environment, retained: false).token

    transaction = @environment.retain_payment_method(card_token)
    assert transaction.succeeded?
    assert_equal "Succeeded!", transaction.message
    assert_equal 'retained', transaction.payment_method.storage_state
  end

  def test_failed_retain
    card_token = create_card_on(@environment).token
    @environment.redact_payment_method(card_token)

    transaction = @environment.retain_payment_method(card_token)
    assert !transaction.succeeded?
    assert_equal "The payment method has been redacted. Therefore, it cannot be retained.", transaction.message
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
spreedly-2.0.28 test/remote/remote_retain_test.rb
spreedly-2.0.27 test/remote/remote_retain_test.rb
spreedly-2.0.26 test/remote/remote_retain_test.rb
spreedly-2.0.25 test/remote/remote_retain_test.rb
spreedly-2.0.24 test/remote/remote_retain_test.rb
spreedly-2.0.23 test/remote/remote_retain_test.rb
spreedly-2.0.22 test/remote/remote_retain_test.rb
spreedly-2.0.21 test/remote/remote_retain_test.rb
spreedly-2.0.20 test/remote/remote_retain_test.rb
spreedly-2.0.19 test/remote/remote_retain_test.rb
spreedly-2.0.18 test/remote/remote_retain_test.rb
spreedly-2.0.17 test/remote/remote_retain_test.rb
spreedly-2.0.16 test/remote/remote_retain_test.rb
spreedly-2.0.15 test/remote/remote_retain_test.rb
spreedly-2.0.14 test/remote/remote_retain_test.rb
spreedly-2.0.13 test/remote/remote_retain_test.rb
spreedly-2.0.11 test/remote/remote_retain_test.rb
spreedly-2.0.10 test/remote/remote_retain_test.rb
spreedly-2.0.9 test/remote/remote_retain_test.rb
spreedly-2.0.8 test/remote/remote_retain_test.rb