diff --git a/Library/Homebrew/cask/cmd/brew-cask-tests.rb b/Library/Homebrew/cask/cmd/brew-cask-tests.rb index b27bc2fe73..a1006b7efb 100755 --- a/Library/Homebrew/cask/cmd/brew-cask-tests.rb +++ b/Library/Homebrew/cask/cmd/brew-cask-tests.rb @@ -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" 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..4616d77082 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -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 = [ 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