From 1b4fdc17f4afa716ded74949c1e06ecce838e919 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 15 Oct 2019 08:52:42 +0100 Subject: [PATCH] Raise deprecation exceptions in tests Previously tests which hit `odeprecated` would print warnings but not always raise exceptions or fail. Combine this with the ability to have `odeprecated` to turn into `odisabled` on certain dates and you have tests that may fail just on the clock changing (this is bad). Instead, ensure that tests always raise deprecations as exceptions so that new deprecations will have their tests handled immediately. --- Library/Homebrew/test/cask/dsl_spec.rb | 4 ++-- Library/Homebrew/test/spec_helper.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index f2bfd2b1f6..1133b3ec15 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -335,11 +335,11 @@ describe Cask::DSL, :cask do end describe "depends_on macos" do - context "valid", :needs_compat do + context "string disabled", :needs_compat do let(:token) { "compat/with-depends-on-macos-string" } it "allows depends_on macos to be specified" do - expect(cask.depends_on.macos).not_to be nil + expect { cask }.to raise_error(Cask::CaskInvalidError) end end diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 7da63374ba..407567d890 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -144,6 +144,7 @@ RSpec.configure do |config| end begin + Homebrew.raise_deprecation_exceptions = true Tap.clear_cache FormulaInstaller.clear_attempted