diff options
| author | Markus Reiter | 2017-02-28 10:33:11 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-28 10:33:11 +0100 |
| commit | a912c60d9a130da02797d603dd64db8ed0a3dc19 (patch) | |
| tree | 07dbe1d6312e4dd7db30cb48b99b211b9b80c797 | |
| parent | 84fbcdc9130e002a1afc2eeb119b7b8c46bf0a13 (diff) | |
| parent | 31b904655f0807c15888defc50e378881d29bd74 (diff) | |
| download | brew-a912c60d9a130da02797d603dd64db8ed0a3dc19.tar.bz2 | |
Merge pull request #2225 from reitermarkus/spec-before_shorthand
Use shorter `before` syntax to skip tests.
| -rw-r--r-- | Library/Homebrew/test/spec_helper.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 9a4dbe026..193de6b8f 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -31,22 +31,23 @@ TEST_DIRECTORIES = [ RSpec.configure do |config| config.order = :random + config.include(Test::Helper::Shutup) config.include(Test::Helper::Fixtures) config.include(Test::Helper::Formula) - config.before(:each) do |example| - if example.metadata[:needs_macos] - skip "Not on macOS." unless OS.mac? - end - if example.metadata[:needs_official_cmd_taps] - skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] - end + config.before(:each, :needs_official_cmd_taps) do + skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] + end - if example.metadata[:needs_python] - skip "Python not installed." unless which("python") - end + config.before(:each, :needs_macos) do + skip "Not on macOS." unless OS.mac? + end + + config.before(:each, :needs_python) do + skip "Python not installed." unless which("python") end + config.around(:each) do |example| begin TEST_DIRECTORIES.each(&:mkpath) |
