Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Library/Homebrew/.simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ SimpleCov.start do
# tests to be dropped. This causes random fluctuations in test coverage.
merge_timeout 86400

add_filter "/Homebrew/cask/spec/"
add_filter "/Homebrew/cask/test/"
add_filter "/Homebrew/compat/"
add_filter "/Homebrew/dev-cmd/tests.rb"
add_filter "/Homebrew/test/"
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/.simplecov

This file was deleted.

11 changes: 0 additions & 11 deletions Library/Homebrew/cask/Gemfile

This file was deleted.

51 changes: 0 additions & 51 deletions Library/Homebrew/cask/Gemfile.lock

This file was deleted.

45 changes: 0 additions & 45 deletions Library/Homebrew/cask/cmd/brew-cask-tests.rb

This file was deleted.

6 changes: 0 additions & 6 deletions Library/Homebrew/cask/spec/upload_coverage.rb

This file was deleted.

7 changes: 7 additions & 0 deletions Library/Homebrew/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

if ENV["HOMEBREW_TESTS_COVERAGE"]
require "simplecov"

if ENV["CODECOV_TOKEN"] || ENV["TRAVIS"]
require "codecov"
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
end

$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew"))
Expand All @@ -18,6 +23,8 @@
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 = [
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -20,25 +16,30 @@
: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

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