Sha256: d0066bd008cdd9b660bb11df4cf443373fce12e4fb60bba0970bfd28324ce93a

Contents?: true

Size: 1.47 KB

Versions: 10

Compression:

Stored size: 1.47 KB

Contents

require 'test_helper'

class RemoteAddReceiverTest < 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.add_receiver(:test, 'http://api.example.com/post')
    end
  end

  def test_non_existent_receiver_type
    assert_raise_with_message(Spreedly::UnexpectedResponseError, "Failed with 403 Forbidden") do
      @environment.add_receiver(:non_existent, nil)
    end
  end

  def test_add_test_receiver_sans_hostname
    assert_raise_with_message(Spreedly::TransactionCreationError, "Hostnames can't be blank") do
      @environment.add_receiver(:test, nil)
    end
  end

  def test_add_test_receiver
    receiver = @environment.add_receiver(:test, 'http://spreedly-echo.herokuapp.com')
    assert_equal "test", receiver.receiver_type
    assert_equal 'http://spreedly-echo.herokuapp.com', receiver.hostnames
  end

  def test_need_active_account
    assert_raise_with_message(Spreedly::PaymentRequiredError, "Your environment (R7lHscqcYkZeDGGbthKp6GKMu15) has not been activated for real transactions with real payment methods. If you're using a Test Gateway you can *ONLY* use Test payment methods - ( https://docs.spreedly.com/test-data). All other credit card numbers are considered real credit cards; real credit cards are not allowed when using a Test Gateway.") do
      @environment.add_receiver(:braintree)
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spreedly-2.0.28 test/remote/remote_add_receiver_test.rb
spreedly-2.0.27 test/remote/remote_add_receiver_test.rb
spreedly-2.0.26 test/remote/remote_add_receiver_test.rb
spreedly-2.0.25 test/remote/remote_add_receiver_test.rb
spreedly-2.0.24 test/remote/remote_add_receiver_test.rb
spreedly-2.0.23 test/remote/remote_add_receiver_test.rb
spreedly-2.0.22 test/remote/remote_add_receiver_test.rb
spreedly-2.0.21 test/remote/remote_add_receiver_test.rb
spreedly-2.0.20 test/remote/remote_add_receiver_test.rb
spreedly-2.0.19 test/remote/remote_add_receiver_test.rb