From 1b4fdc17f4afa716ded74949c1e06ecce838e919 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 15 Oct 2019 08:52:42 +0100 Subject: [PATCH 1/3] 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 From 02ded996a49f68539b7d84328f9388dd0c27fb18 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 15 Oct 2019 09:12:51 +0100 Subject: [PATCH 2/3] formulary_spec: remove deprecated tap-pin usage. --- Library/Homebrew/test/formulary_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index 326657456f..08af7a5c7c 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -246,12 +246,6 @@ describe Formulary do formula = described_class.find_with_priority(formula_name) expect(formula.path).to eq(core_path) end - - it "prioritizes Formulae from pinned Taps" do - tap.pin - formula = described_class.find_with_priority(formula_name) - expect(formula.path).to eq(tap_path.realpath) - end end describe "::core_path" do From 8a93230c1546bb172a81e1aa27083b98e2e3b5d0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 15 Oct 2019 09:52:33 +0100 Subject: [PATCH 3/3] test/cask: remove disabled functionality tests. --- Library/Homebrew/test/cask/depends_on_spec.rb | 8 -------- Library/Homebrew/test/cask/dsl_spec.rb | 8 -------- 2 files changed, 16 deletions(-) diff --git a/Library/Homebrew/test/cask/depends_on_spec.rb b/Library/Homebrew/test/cask/depends_on_spec.rb index 2917d6dac6..9be83dac3f 100644 --- a/Library/Homebrew/test/cask/depends_on_spec.rb +++ b/Library/Homebrew/test/cask/depends_on_spec.rb @@ -47,14 +47,6 @@ describe "Satisfy Dependencies and Requirements", :cask do end end - context "given a string", :needs_compat do - let(:cask) { Cask::CaskLoader.load(cask_path("compat/with-depends-on-macos-string")) } - - it "does not raise an error" do - expect { install }.not_to raise_error - end - end - context "given a symbol" do let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-macos-symbol")) } diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 1133b3ec15..24b4a06dc2 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -335,14 +335,6 @@ describe Cask::DSL, :cask do end describe "depends_on macos" 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 }.to raise_error(Cask::CaskInvalidError) - end - end - context "invalid depends_on macos value" do let(:token) { "invalid/invalid-depends-on-macos-bad-release" }