Move Cask specs into brew tests.

This commit is contained in:
Markus Reiter 2017-03-05 06:31:36 +01:00
parent 67ec76d149
commit 9fc6c7b2be
62 changed files with 14 additions and 23 deletions

View File

@ -26,18 +26,6 @@ cask_root.cd do
upload_coverage = ENV["CODECOV_TOKEN"] || ENV["TRAVIS"]
end
run_tests "parallel_rspec", Dir["spec/**/*_spec.rb"], %w[
--color
--require spec_helper
--format progress
--format ParallelTests::RSpec::RuntimeLogger
--out tmp/parallel_runtime_rspec.log
]
unless $CHILD_STATUS.success?
Homebrew.failed = true
end
if upload_coverage
puts "Submitting Codecov coverage..."
system "bundle", "exec", "spec/upload_coverage.rb"

View File

@ -18,6 +18,8 @@ require "test/support/helper/shutup"
require "test/support/helper/fixtures"
require "test/support/helper/formula"
require "test/support/helper/mktmpdir"
require "test/support/helper/spec/shared_context/homebrew_cask" if OS.mac?
require "test/support/helper/spec/shared_context/integration_test"
TEST_DIRECTORIES = [

View File

@ -1,7 +1,3 @@
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew"))
require "test/spec_helper"
# add Homebrew-Cask to load path
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s)
require "hbc"
@ -20,18 +16,17 @@ HOMEBREW_CASK_DIRS = [
:binarydir,
].freeze
RSpec.configure do |config|
config.around(:each) do |example|
RSpec.shared_context "Homebrew-Cask" do
around(:each) do |example|
begin
dirs = HOMEBREW_CASK_DIRS.map { |dir|
Pathname.new(TEST_TMPDIR).join("cask-#{dir}").tap { |path|
dirs = HOMEBREW_CASK_DIRS.map do |dir|
Pathname.new(TEST_TMPDIR).join("cask-#{dir}").tap do |path|
path.mkpath
Hbc.public_send("#{dir}=", path)
}
}
end
end
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
@ -39,6 +34,12 @@ RSpec.configure do |config|
example.run
ensure
FileUtils.rm_rf dirs
Hbc.default_tap.path.unlink
FileUtils.rm_rf Hbc.default_tap.path.parent
end
end
end
RSpec.configure do |config|
config.include_context "Homebrew-Cask", :cask
end