Skip to content

Commit

Permalink
Retry timed out real requests when running webmock specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bblimke committed Aug 14, 2023
1 parent 6c0a8ff commit 47223fb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/acceptance/curb/curb_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setup_request(uri, curl, options={})
curl.password = options[:basic_auth][1]
end
curl.timeout = 30
curl.connect_timeout = 30
curl.connect_timeout = 5

if headers = options[:headers]
headers.each {|k,v| curl.headers[k] = v }
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/webmock_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
WebMock.reset!
end

around(:each, net_connect: true) do |ex|
ex.run_with_retry retry: 2, exceptions_to_retry: [client_timeout_exception_class]
end

include_context "allowing and disabling net connect", *adapter_info

include_context "stubbing requests", *adapter_info
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rspec'
require 'rspec/retry'

require 'webmock/rspec'

Expand Down
1 change: 1 addition & 0 deletions webmock.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'test-unit', '>= 3.0.0'
s.add_development_dependency 'rdoc', '> 3.5.0'
s.add_development_dependency 'webrick'
s.add_development_dependency 'rspec-retry'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down

0 comments on commit 47223fb

Please sign in to comment.