From fddd6fd5e009cbb2873a8d9d7a5ade4899a41dcd Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Fri, 17 Jun 2022 13:45:16 +0200 Subject: [PATCH] DEV: Fix an rspec warning (#17123) ``` WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. `NoMethodError`, `NameError` and `ArgumentError`), meaning the code you are intending to test may not even get reached. Instead consider using `expect { }.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. Called from /var/www/discourse/spec/lib/retrieve_title_spec.rb:155:in `block (3 levels) in
'. ``` --- spec/lib/retrieve_title_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/retrieve_title_spec.rb b/spec/lib/retrieve_title_spec.rb index 6711f233f1..74d56ce08e 100644 --- a/spec/lib/retrieve_title_spec.rb +++ b/spec/lib/retrieve_title_spec.rb @@ -152,7 +152,7 @@ describe RetrieveTitle do it "it ignores Net::ReadTimeout errors" do stub_request(:get, "https://example.com").to_raise(Net::ReadTimeout) - expect { RetrieveTitle.crawl("https://example.com") }.not_to raise_error(Net::ReadTimeout) + expect { RetrieveTitle.crawl("https://example.com") }.not_to raise_error end end