Skip to content

Commit

Permalink
Merge pull request #4982 from rolandwalker/test_env_changes
Browse files Browse the repository at this point in the history
Adjust to Homebrew's test environment changes
  • Loading branch information
rolandwalker committed Jun 19, 2014
2 parents b905581 + 62fff58 commit d3278a5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

group :test do
gem 'rake'
gem 'minitest', '4.7.0'
gem 'minitest', '5.3'
gem 'minitest-colorize'
gem 'mocha', '0.14.0'
end
4 changes: 2 additions & 2 deletions Gemfile.lock
Expand Up @@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
metaclass (0.0.1)
minitest (4.7.0)
minitest (5.3)
minitest-colorize (0.0.5)
minitest (>= 2.0)
mocha (0.14.0)
Expand All @@ -13,7 +13,7 @@ PLATFORMS
ruby

DEPENDENCIES
minitest (= 4.7.0)
minitest (= 5.3)
minitest-colorize
mocha (= 0.14.0)
rake
21 changes: 20 additions & 1 deletion test/test_helper.rb
Expand Up @@ -22,13 +22,32 @@
# require homebrew testing env
require 'test/testing_env'

# todo temporary, copied from old Homebrew, this method is now moved inside a class
def shutup
if ARGV.verbose?
yield
else
begin
tmperr = $stderr.clone
tmpout = $stdout.clone
$stderr.reopen '/dev/null', 'w'
$stdout.reopen '/dev/null', 'w'
yield
ensure
$stderr.reopen tmperr
$stdout.reopen tmpout
end
end
end

# making homebrew's cache dir allows us to actually download casks in tests
HOMEBREW_CACHE.mkpath
HOMEBREW_CACHE.join('Casks').mkpath

# must be called after testing_env so at_exit hooks are in proper order
require 'minitest/autorun'
require 'minitest-colorize'
# todo, re-enable minitest-colorize, broken under current test environment for unknown reasons
# require 'minitest-colorize'

# Force mocha to patch MiniTest since we have both loaded thanks to homebrew's testing_env
require 'mocha/api'
Expand Down

0 comments on commit d3278a5

Please sign in to comment.