Sha256: 70693b9f9119c818a66817fa2e06b7c35d2d825f6d975fc1fa3daf7128373feb

Contents?: true

Size: 1.2 KB

Versions: 27

Compression:

Stored size: 1.2 KB

Contents

require 'test_helper'
require 'unit/response_stubs/list_gateways_stubs'

class ListGatewaysTest < Test::Unit::TestCase

  include ListGatewaysStubs

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

  def test_successful_list_payment_methods
    list = list_using(successful_list_gateways_response)

    assert_kind_of(Array, list)
    assert_equal 2, list.size

    assert_equal 'OJUFe5ZR6pFfL4i4ZGVmvGWkZUY', list.first.token
    assert_equal '52wqOssuKZSXEYde30AGTG6xl8v', list.last.token
    assert_kind_of Spreedly::Gateway, list.first
    assert_kind_of Spreedly::Gateway, list.last
  end

  def test_request_url
    assert_request_url 'https://core.spreedly.com/v1/gateways.xml' do
      @environment.list_gateways
    end

    assert_request_url 'https://core.spreedly.com/v1/gateways.xml?since_token=SomeToken' do
      @environment.list_gateways("SomeToken")
    end
  end

  private
  def list_using(response)
    @environment.stubs(:raw_ssl_request).returns(response)
    @environment.list_gateways
  end

  def assert_request_url(expected_url)
    actual_url = get_request_url(successful_list_gateways_response) do
      yield
    end
    assert_equal expected_url, actual_url
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

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