2015-03-18 07:56:58 +08:00
|
|
|
require 'coveralls'
|
|
|
|
|
|
|
|
Coveralls.wear_merged!
|
2014-12-20 23:25:18 +08:00
|
|
|
|
|
|
|
# just in case
|
|
|
|
if RUBY_VERSION.to_i < 2
|
|
|
|
raise 'brew-cask: Ruby 2.0 or greater is required.'
|
|
|
|
end
|
|
|
|
|
2014-06-29 08:33:03 +08:00
|
|
|
project_root = Pathname(File.expand_path("../..", __FILE__))
|
|
|
|
|
2015-01-25 00:00:25 +08:00
|
|
|
Dir["#{project_root}/spec/support/*.rb"].each { |f| require f }
|
2014-06-29 08:33:03 +08:00
|
|
|
|
|
|
|
include HomebrewTestingEnvironment
|
2014-12-19 22:54:14 +08:00
|
|
|
# from Homebrew. Provides expects method.
|
|
|
|
require 'mocha/api'
|
2014-06-29 08:33:03 +08:00
|
|
|
|
2014-10-08 22:39:51 +08:00
|
|
|
# add homebrew-cask lib to load path
|
2014-06-29 08:33:03 +08:00
|
|
|
$:.push(project_root.join('lib').to_s)
|
|
|
|
|
2015-01-01 22:08:06 +08:00
|
|
|
require 'hbc'
|
2014-06-29 08:33:03 +08:00
|
|
|
|
2015-02-08 05:56:06 +08:00
|
|
|
module Hbc
|
|
|
|
class TestCask < Cask; end
|
|
|
|
end
|
2015-01-25 00:00:25 +08:00
|
|
|
|
2015-01-07 22:09:53 +08:00
|
|
|
# override Homebrew locations
|
|
|
|
Hbc.homebrew_prefix = Pathname.new(TEST_TMPDIR).join('prefix')
|
|
|
|
Hbc.homebrew_repository = Hbc.homebrew_prefix
|
|
|
|
Hbc.homebrew_tapspath = nil
|
2015-01-25 00:00:25 +08:00
|
|
|
Hbc.binarydir = Hbc.homebrew_prefix.join('binarydir').join('bin')
|
2015-01-07 22:09:53 +08:00
|
|
|
|
|
|
|
# making homebrew's cache dir allows us to actually download Casks in tests
|
|
|
|
HOMEBREW_CACHE.mkpath
|
|
|
|
HOMEBREW_CACHE.join('Casks').mkpath
|
|
|
|
|
2014-10-08 22:39:51 +08:00
|
|
|
# Look for Casks in testcasks by default. It is elsewhere required that
|
2014-06-29 08:33:03 +08:00
|
|
|
# the string "test" appear in the directory name.
|
2015-01-25 00:00:25 +08:00
|
|
|
Hbc.default_tap = project_root.join('spec', 'support')
|
2014-06-29 08:33:03 +08:00
|
|
|
|
|
|
|
# our own testy caskroom
|
2015-01-07 22:09:53 +08:00
|
|
|
Hbc.caskroom = Hbc.homebrew_prefix.join('TestCaskroom')
|
2014-06-29 08:33:03 +08:00
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include ShutupHelper
|
|
|
|
end
|