diff --git a/Library/Homebrew/.simplecov b/Library/Homebrew/.simplecov index d2e00cf469..23e60faeb0 100755 --- a/Library/Homebrew/.simplecov +++ b/Library/Homebrew/.simplecov @@ -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/" diff --git a/Library/Homebrew/cask/.simplecov b/Library/Homebrew/cask/.simplecov deleted file mode 120000 index 75a078be4a..0000000000 --- a/Library/Homebrew/cask/.simplecov +++ /dev/null @@ -1 +0,0 @@ -../.simplecov \ No newline at end of file diff --git a/Library/Homebrew/cask/Gemfile b/Library/Homebrew/cask/Gemfile deleted file mode 100644 index bc9bccfbca..0000000000 --- a/Library/Homebrew/cask/Gemfile +++ /dev/null @@ -1,11 +0,0 @@ -source "https://rubygems.org" - -gem "parallel_tests" -gem "rspec" -gem "rspec-its", require: false -gem "rspec-wait", require: false - -group :coverage do - gem "simplecov", require: false - gem "codecov", require: false -end diff --git a/Library/Homebrew/cask/Gemfile.lock b/Library/Homebrew/cask/Gemfile.lock deleted file mode 100644 index 64561be715..0000000000 --- a/Library/Homebrew/cask/Gemfile.lock +++ /dev/null @@ -1,51 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - codecov (0.1.9) - json - simplecov - url - diff-lcs (1.3) - docile (1.1.5) - json (2.0.3) - parallel (1.10.0) - parallel_tests (2.13.0) - parallel - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-its (1.2.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) - rspec-mocks (3.5.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - rspec-wait (0.0.9) - rspec (>= 3, < 4) - simplecov (0.13.0) - docile (~> 1.1.0) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) - url (0.3.2) - -PLATFORMS - ruby - -DEPENDENCIES - codecov - parallel_tests - rspec - rspec-its - rspec-wait - simplecov - -BUNDLED WITH - 1.14.5 diff --git a/Library/Homebrew/cask/cmd/brew-cask-tests.rb b/Library/Homebrew/cask/cmd/brew-cask-tests.rb deleted file mode 100755 index b27bc2fe73..0000000000 --- a/Library/Homebrew/cask/cmd/brew-cask-tests.rb +++ /dev/null @@ -1,45 +0,0 @@ -require "English" - -ENV["BUNDLE_GEMFILE"] = "#{HOMEBREW_LIBRARY_PATH}/cask/Gemfile" -ENV["BUNDLE_PATH"] = "#{HOMEBREW_LIBRARY_PATH}/vendor/bundle" - -def run_tests(executable, files, args = []) - opts = [] - opts << "--serialize-stdout" if ENV["CI"] - - system "bundle", "exec", executable, *opts, "--", *args, "--", *files -end - -cask_root = Pathname.new(__FILE__).realpath.parent.parent -cask_root.cd do - ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" - ENV["HOMEBREW_NO_EMOJI"] = "1" - ENV.delete("HOMEBREW_CASK_OPTS") - - Homebrew.install_gem_setup_path! "bundler" - unless quiet_system("bundle", "check") - system "bundle", "install" - end - - if ARGV.flag?("--coverage") - ENV["HOMEBREW_TESTS_COVERAGE"] = "1" - 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" - end -end diff --git a/Library/Homebrew/cask/spec/upload_coverage.rb b/Library/Homebrew/cask/spec/upload_coverage.rb deleted file mode 100755 index 06d38157dd..0000000000 --- a/Library/Homebrew/cask/spec/upload_coverage.rb +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -require "simplecov" -require "codecov" - -formatter = SimpleCov::Formatter::Codecov.new -formatter.format SimpleCov::ResultMerger.merged_result diff --git a/Library/Homebrew/cask/spec/cask/accessibility_spec.rb b/Library/Homebrew/test/cask/accessibility_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/accessibility_spec.rb rename to Library/Homebrew/test/cask/accessibility_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/alt_target_spec.rb b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/alt_target_spec.rb rename to Library/Homebrew/test/cask/artifact/alt_target_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/app_spec.rb rename to Library/Homebrew/test/cask/artifact/app_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb rename to Library/Homebrew/test/cask/artifact/binary_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/generic_artifact_spec.rb b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/generic_artifact_spec.rb rename to Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/nested_container_spec.rb b/Library/Homebrew/test/cask/artifact/nested_container_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/nested_container_spec.rb rename to Library/Homebrew/test/cask/artifact/nested_container_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/pkg_spec.rb b/Library/Homebrew/test/cask/artifact/pkg_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/pkg_spec.rb rename to Library/Homebrew/test/cask/artifact/pkg_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/postflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/postflight_block_spec.rb rename to Library/Homebrew/test/cask/artifact/postflight_block_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/preflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/preflight_block_spec.rb rename to Library/Homebrew/test/cask/artifact/preflight_block_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/suite_spec.rb b/Library/Homebrew/test/cask/artifact/suite_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/suite_spec.rb rename to Library/Homebrew/test/cask/artifact/suite_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/two_apps_correct_spec.rb b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/two_apps_correct_spec.rb rename to Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/two_apps_incorrect_spec.rb b/Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/two_apps_incorrect_spec.rb rename to Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/uninstall_no_zap_spec.rb b/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/uninstall_no_zap_spec.rb rename to Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb b/Library/Homebrew/test/cask/artifact/uninstall_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb rename to Library/Homebrew/test/cask/artifact/uninstall_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb b/Library/Homebrew/test/cask/artifact/zap_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb rename to Library/Homebrew/test/cask/artifact/zap_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/audit_spec.rb rename to Library/Homebrew/test/cask/audit_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cask_spec.rb rename to Library/Homebrew/test/cask/cask_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/audit_spec.rb b/Library/Homebrew/test/cask/cli/audit_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/audit_spec.rb rename to Library/Homebrew/test/cask/cli/audit_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/cat_spec.rb b/Library/Homebrew/test/cask/cli/cat_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/cat_spec.rb rename to Library/Homebrew/test/cask/cli/cat_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/cleanup_spec.rb b/Library/Homebrew/test/cask/cli/cleanup_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/cleanup_spec.rb rename to Library/Homebrew/test/cask/cli/cleanup_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/create_spec.rb b/Library/Homebrew/test/cask/cli/create_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/create_spec.rb rename to Library/Homebrew/test/cask/cli/create_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/doctor_spec.rb b/Library/Homebrew/test/cask/cli/doctor_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/doctor_spec.rb rename to Library/Homebrew/test/cask/cli/doctor_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/edit_spec.rb b/Library/Homebrew/test/cask/cli/edit_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/edit_spec.rb rename to Library/Homebrew/test/cask/cli/edit_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/fetch_spec.rb b/Library/Homebrew/test/cask/cli/fetch_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/fetch_spec.rb rename to Library/Homebrew/test/cask/cli/fetch_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/home_spec.rb b/Library/Homebrew/test/cask/cli/home_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/home_spec.rb rename to Library/Homebrew/test/cask/cli/home_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/info_spec.rb b/Library/Homebrew/test/cask/cli/info_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/info_spec.rb rename to Library/Homebrew/test/cask/cli/info_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/install_spec.rb rename to Library/Homebrew/test/cask/cli/install_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/list_spec.rb b/Library/Homebrew/test/cask/cli/list_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/list_spec.rb rename to Library/Homebrew/test/cask/cli/list_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/options_spec.rb b/Library/Homebrew/test/cask/cli/options_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/options_spec.rb rename to Library/Homebrew/test/cask/cli/options_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/reinstall_spec.rb rename to Library/Homebrew/test/cask/cli/reinstall_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/search_spec.rb b/Library/Homebrew/test/cask/cli/search_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/search_spec.rb rename to Library/Homebrew/test/cask/cli/search_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/style_spec.rb rename to Library/Homebrew/test/cask/cli/style_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb rename to Library/Homebrew/test/cask/cli/uninstall_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/version_spec.rb b/Library/Homebrew/test/cask/cli/version_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/version_spec.rb rename to Library/Homebrew/test/cask/cli/version_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli/zap_spec.rb b/Library/Homebrew/test/cask/cli/zap_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli/zap_spec.rb rename to Library/Homebrew/test/cask/cli/zap_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/cli_spec.rb rename to Library/Homebrew/test/cask/cli_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/container/dmg_spec.rb b/Library/Homebrew/test/cask/container/dmg_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/container/dmg_spec.rb rename to Library/Homebrew/test/cask/container/dmg_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/container/naked_spec.rb b/Library/Homebrew/test/cask/container/naked_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/container/naked_spec.rb rename to Library/Homebrew/test/cask/container/naked_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/depends_on_spec.rb b/Library/Homebrew/test/cask/depends_on_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/depends_on_spec.rb rename to Library/Homebrew/test/cask/depends_on_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/download_strategy_spec.rb b/Library/Homebrew/test/cask/download_strategy_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/download_strategy_spec.rb rename to Library/Homebrew/test/cask/download_strategy_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb b/Library/Homebrew/test/cask/dsl/caveats_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb rename to Library/Homebrew/test/cask/dsl/caveats_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb b/Library/Homebrew/test/cask/dsl/postflight_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb rename to Library/Homebrew/test/cask/dsl/postflight_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb b/Library/Homebrew/test/cask/dsl/preflight_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb rename to Library/Homebrew/test/cask/dsl/preflight_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/stanza_proxy_spec.rb b/Library/Homebrew/test/cask/dsl/stanza_proxy_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/stanza_proxy_spec.rb rename to Library/Homebrew/test/cask/dsl/stanza_proxy_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb b/Library/Homebrew/test/cask/dsl/uninstall_postflight_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb rename to Library/Homebrew/test/cask/dsl/uninstall_postflight_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb b/Library/Homebrew/test/cask/dsl/uninstall_preflight_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb rename to Library/Homebrew/test/cask/dsl/uninstall_preflight_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl/version_spec.rb b/Library/Homebrew/test/cask/dsl/version_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl/version_spec.rb rename to Library/Homebrew/test/cask/dsl/version_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/dsl_spec.rb rename to Library/Homebrew/test/cask/dsl_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/installer_spec.rb b/Library/Homebrew/test/cask/installer_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/installer_spec.rb rename to Library/Homebrew/test/cask/installer_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/macos_spec.rb b/Library/Homebrew/test/cask/macos_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/macos_spec.rb rename to Library/Homebrew/test/cask/macos_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/pkg_spec.rb b/Library/Homebrew/test/cask/pkg_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/pkg_spec.rb rename to Library/Homebrew/test/cask/pkg_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/scopes_spec.rb b/Library/Homebrew/test/cask/scopes_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/scopes_spec.rb rename to Library/Homebrew/test/cask/scopes_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/staged_spec.rb b/Library/Homebrew/test/cask/staged_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/staged_spec.rb rename to Library/Homebrew/test/cask/staged_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/system_command_result_spec.rb b/Library/Homebrew/test/cask/system_command_result_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/system_command_result_spec.rb rename to Library/Homebrew/test/cask/system_command_result_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/system_command_spec.rb b/Library/Homebrew/test/cask/system_command_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/system_command_spec.rb rename to Library/Homebrew/test/cask/system_command_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/underscore_supporting_uri_spec.rb b/Library/Homebrew/test/cask/underscore_supporting_uri_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/underscore_supporting_uri_spec.rb rename to Library/Homebrew/test/cask/underscore_supporting_uri_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/url_checker_spec.rb b/Library/Homebrew/test/cask/url_checker_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/url_checker_spec.rb rename to Library/Homebrew/test/cask/url_checker_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/verify/checksum_spec.rb b/Library/Homebrew/test/cask/verify/checksum_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/verify/checksum_spec.rb rename to Library/Homebrew/test/cask/verify/checksum_spec.rb diff --git a/Library/Homebrew/cask/spec/cask/verify_spec.rb b/Library/Homebrew/test/cask/verify_spec.rb similarity index 100% rename from Library/Homebrew/cask/spec/cask/verify_spec.rb rename to Library/Homebrew/test/cask/verify_spec.rb diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 122aaba46d..c8e5cc0f89 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -6,6 +6,11 @@ require "set" 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")) @@ -18,6 +23,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 = [ diff --git a/Library/Homebrew/cask/spec/spec_helper.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb similarity index 68% rename from Library/Homebrew/cask/spec/spec_helper.rb rename to Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index 0b3a120cac..c51d339a7c 100644 --- a/Library/Homebrew/cask/spec/spec_helper.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -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