mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #6134 from Matt-Yorkley/webmock-helper
Improve Webmock debugging
This commit is contained in:
@@ -121,6 +121,7 @@ RSpec.configure do |config|
|
||||
.select { |s| s.driver.is_a?(Capybara::Selenium::Driver) }
|
||||
.each { |s| s.driver.reset! }
|
||||
end
|
||||
config.before(:all) { restart_driver }
|
||||
|
||||
# Enable caching in any specs tagged with `caching: true`. Usage is exactly the same as the
|
||||
# well-known `js: true` tag used to enable javascript in feature specs.
|
||||
@@ -140,7 +141,18 @@ RSpec.configure do |config|
|
||||
end
|
||||
end
|
||||
|
||||
config.before(:all) { restart_driver }
|
||||
# Webmock raises errors that inherit directly from Exception (not StandardError).
|
||||
# The messages contain useful information for debugging stubbed requests to external
|
||||
# services (in tests), but they normally don't appear in the test output.
|
||||
config.before(:all) do
|
||||
ApplicationController.class_eval do
|
||||
rescue_from WebMock::NetConnectNotAllowedError, with: :handle_webmock_error
|
||||
|
||||
def handle_webmock_error(exception)
|
||||
raise exception.message
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Geocoding
|
||||
config.before(:each) { allow_any_instance_of(Spree::Address).to receive(:geocode).and_return([1, 1]) }
|
||||
|
||||
Reference in New Issue
Block a user