From e449d78e2393d2aaab1a2777980e48e40d4a5388 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Fri, 18 Jun 2021 11:32:10 -0700 Subject: [PATCH] Resolve warning about test using `not_to raise_error` Resolves: > 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)`. --- spec/pdfs/ticket_pdf_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/pdfs/ticket_pdf_spec.rb b/spec/pdfs/ticket_pdf_spec.rb index 13ecd8ec..2ed9c064 100644 --- a/spec/pdfs/ticket_pdf_spec.rb +++ b/spec/pdfs/ticket_pdf_spec.rb @@ -50,6 +50,6 @@ describe TicketPdf do .to_return(status: 404, body: '', headers: {}) pdf = described_class.new(conference, participant, physical_ticket, layout, file_name) - expect{ PDF::Inspector::Page.analyze(pdf.render) }.to_not raise_error(OpenURI::HTTPError) + expect{ PDF::Inspector::Page.analyze(pdf.render) }.to_not raise_error end end