test/test_helper.rb in stripe-4.5.0 vs test/test_helper.rb in stripe-4.6.0
- old
+ new
@@ -12,14 +12,15 @@
require "webmock/test_unit"
PROJECT_ROOT = ::File.expand_path("../../", __FILE__)
require ::File.expand_path("../test_data", __FILE__)
+require ::File.expand_path("../stripe_mock", __FILE__)
# If changing this number, please also change it in `.travis.yml`.
-MOCK_MINIMUM_VERSION = "0.40.0".freeze
-MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
+MOCK_MINIMUM_VERSION = "0.40.1".freeze
+MOCK_PORT = Stripe::StripeMock.start
# Disable all real network connections except those that are outgoing to
# stripe-mock.
WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")
@@ -37,9 +38,13 @@
"see its repository for upgrade instructions.")
end
rescue Faraday::ConnectionFailed
abort("Couldn't reach stripe-mock at `localhost:#{MOCK_PORT}`. Is " \
"it running? Please see README for setup instructions.")
+end
+
+Test::Unit.at_exit do
+ Stripe::StripeMock.stop
end
module Test
module Unit
class TestCase