diff options
| author | Markus Reiter | 2017-03-05 04:28:14 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-05 04:38:30 +0100 |
| commit | 551993a9c79912ed48c3d649414eb1e6d1b980b0 (patch) | |
| tree | 2e8d1ffd26404f953afc8dbf8dd154dc91181bee /Library/Homebrew | |
| parent | e0e0233b2df895f8d915f7766639f8fb62d03ee4 (diff) | |
| download | brew-551993a9c79912ed48c3d649414eb1e6d1b980b0.tar.bz2 | |
Update Cask `spec_helper`.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cask/spec/spec_helper.rb | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/Library/Homebrew/cask/spec/spec_helper.rb b/Library/Homebrew/cask/spec/spec_helper.rb index 985a5335f..ca0b69d33 100644 --- a/Library/Homebrew/cask/spec/spec_helper.rb +++ b/Library/Homebrew/cask/spec/spec_helper.rb @@ -1,32 +1,13 @@ -require "rspec/its" -require "rspec/wait" - -if ENV["HOMEBREW_TESTS_COVERAGE"] - require "simplecov" -end - -# add Homebrew to load path $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew")) -$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew/test/support/lib")) - -require "global" +require "test/spec_helper" # add Homebrew-Cask to load path $LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s) -require "test/support/helper/shutup" - Pathname.glob(HOMEBREW_LIBRARY_PATH.join("cask", "spec", "support", "**", "*.rb")).each(&method(:require)) require "hbc" -# create and override default directories -Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap| - # link test casks - FileUtils.mkdir_p tap.path.dirname - FileUtils.ln_s TEST_FIXTURE_DIR.join("cask"), tap.path -end - HOMEBREW_CASK_DIRS = [ :appdir, :caskroom, @@ -38,26 +19,24 @@ HOMEBREW_CASK_DIRS = [ ].freeze RSpec.configure do |config| - config.order = :random - config.include(Test::Helper::Shutup) config.around(:each) do |example| begin - @__dirs = HOMEBREW_CASK_DIRS.map { |dir| - Pathname.new(TEST_TMPDIR).join(dir.to_s).tap { |path| + dirs = HOMEBREW_CASK_DIRS.map { |dir| + Pathname.new(TEST_TMPDIR).join("cask-#{dir}").tap { |path| path.mkpath Hbc.public_send("#{dir}=", path) } } - @__argv = ARGV.dup - @__env = ENV.to_hash # dup doesn't work on ENV + Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap| + # link test casks + FileUtils.mkdir_p tap.path.dirname + FileUtils.ln_sf TEST_FIXTURE_DIR.join("cask"), tap.path + end example.run ensure - ARGV.replace(@__argv) - ENV.replace(@__env) - - FileUtils.rm_rf @__dirs.map(&:children) + FileUtils.rm_rf dirs end end end |
