Merge pull request #607 from stripe/brandur-remove-manual-stubs

Remove manual exchange rate stubbing
This commit is contained in:
Brandur 2017-10-31 09:49:39 -07:00 committed by GitHub
commit ffb6ea4a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 28 deletions

View File

@ -16,7 +16,7 @@ sudo: false
env:
global:
- STRIPE_MOCK_VERSION=0.2.0
- STRIPE_MOCK_VERSION=0.4.0
cache:
directories:

View File

@ -3,24 +3,6 @@ require File.expand_path("../../test_helper", __FILE__)
module Stripe
class ExchangeRateTest < Test::Unit::TestCase
should "be listable" do
# TODO: remove stub once stripe-mock supports /v1/exchange_rates
stub_request(:get, "#{Stripe.api_base}/v1/exchange_rates")
.to_return(body: JSON.generate(
object: "list",
data: [
{
id: "eur",
object: "exchange_rate",
rates: { "usd" => 1.18221 },
},
{
id: "usd",
object: "exchange_rate",
rates: { "eur" => 0.845876 },
},
]
))
list_rates = Stripe::ExchangeRate.list
assert_requested :get, "#{Stripe.api_base}/v1/exchange_rates"
assert list_rates.data.is_a?(Array)
@ -28,14 +10,6 @@ module Stripe
end
should "be retrievable" do
# TODO: remove stub once stripe-mock supports /v1/exchange_rates
stub_request(:get, "#{Stripe.api_base}/v1/exchange_rates/usd")
.to_return(body: JSON.generate(
id: "usd",
object: "exchange_rate",
rates: { "eur" => 0.845876 }
))
rates = Stripe::ExchangeRate.retrieve("usd")
assert_requested :get, "#{Stripe.api_base}/v1/exchange_rates/usd"
assert rates.is_a?(Stripe::ExchangeRate)

View File

@ -10,7 +10,7 @@ PROJECT_ROOT = File.expand_path("../../", __FILE__)
require File.expand_path("../test_data", __FILE__)
MOCK_MINIMUM_VERSION = "0.2.0".freeze
MOCK_MINIMUM_VERSION = "0.4.0".freeze
MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
# Disable all real network connections except those that are outgoing to