A platform for community discussion. Free, open, simple.
DEV: Fix flaky `FinalDestination` specs
Loïc Guitautc9d22b643f62
diff --git a/spec/lib/final_destination_spec.rb b/spec/lib/final_destination_spec.rbindex bd64fb508ef..1e44823709b 100644--- a/spec/lib/final_destination_spec.rb+++ b/spec/lib/final_destination_spec.rb@@ -427,9 +427,12 @@ describe FinalDestination dodescribe '#get' dolet(:fd) { FinalDestination.new("http://wikipedia.com", opts.merge(verbose: true)) }+ before do+ described_class.clear_https_cache!("wikipedia.com")+ end+context "when there is a redirect" dobefore do- described_class.clear_https_cache!("wikipedia.com")stub_request(:get, "http://wikipedia.com/").to_return(status: 302, body: "" , headers: { "location" => "https://wikipedia.com/" })# webmock does not do chunks@@ -457,12 +460,11 @@ describe FinalDestination dosubject(:get) { fd.get {} }before do- described_class.clear_https_cache!("wikipedia.com")fd.stubs(:safe_session).raises(Timeout::Error)endit "logs the exception" do- Rails.logger.expects(:warn).with("default: FinalDestination could not resolve URL (timeout): http://wikipedia.com")+ Rails.logger.expects(:warn).with(regexp_matches(/FinalDestination could not resolve URL \(timeout\)/))getend