Skip to content

Commit

Permalink
Remove manual exchange rate stubbing
Browse files Browse the repository at this point in the history
stripe-mock 0.4.0 comes with the up-to-date exchange rates API. Here we
bump the required version and remove the manual exchange rate stubbing
in stripe-ruby's test suite.
  • Loading branch information
brandur committed Oct 31, 2017
1 parent 44e590f commit 85c811a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sudo: false

env:
global:
- STRIPE_MOCK_VERSION=0.2.0
- STRIPE_MOCK_VERSION=0.4.0

cache:
directories:
Expand Down
26 changes: 0 additions & 26 deletions test/stripe/exchange_rate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,13 @@
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)
assert list_rates.data.first.is_a?(Stripe::ExchangeRate)
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)
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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
Expand Down

0 comments on commit 85c811a

Please sign in to comment.