tests: reduce some noise.
- Tweak the way offline skipping happens - Skip more tests that break when offline - Hide more stdout output from tests.
This commit is contained in:
parent
268f2dbde2
commit
a6df701fad
@ -33,7 +33,12 @@ module Homebrew
|
|||||||
ENV["HOMEBREW_DEVELOPER"] = "1"
|
ENV["HOMEBREW_DEVELOPER"] = "1"
|
||||||
ENV["HOMEBREW_NO_COMPAT"] = "1" if ARGV.include? "--no-compat"
|
ENV["HOMEBREW_NO_COMPAT"] = "1" if ARGV.include? "--no-compat"
|
||||||
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if ARGV.include? "--generic"
|
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if ARGV.include? "--generic"
|
||||||
ENV["HOMEBREW_NO_GITHUB_API"] = "1" unless ARGV.include? "--online"
|
|
||||||
|
if ARGV.include? "--online"
|
||||||
|
ENV["HOMEBREW_TEST_ONLINE"] = "1"
|
||||||
|
else
|
||||||
|
ENV["HOMEBREW_NO_GITHUB_API"] = "1"
|
||||||
|
end
|
||||||
|
|
||||||
if ARGV.include? "--official-cmd-taps"
|
if ARGV.include? "--official-cmd-taps"
|
||||||
ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] = "1"
|
ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] = "1"
|
||||||
|
@ -81,7 +81,7 @@ describe Hbc::CLI::Style, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "version" do
|
context "version" do
|
||||||
it "matches `HOMEBREW_RUBOCOP_VERSION`" do
|
it "matches `HOMEBREW_RUBOCOP_VERSION`", :needs_network do
|
||||||
stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote")
|
stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote")
|
||||||
|
|
||||||
expect(status).to be_a_success
|
expect(status).to be_a_success
|
||||||
|
@ -13,7 +13,9 @@ describe Hbc::CLI::Uninstall, :cask do
|
|||||||
|
|
||||||
it "tries anyway on a non-present Cask when --force is given" do
|
it "tries anyway on a non-present Cask when --force is given" do
|
||||||
expect {
|
expect {
|
||||||
|
shutup do
|
||||||
Hbc::CLI::Uninstall.run("local-caffeine", "--force")
|
Hbc::CLI::Uninstall.run("local-caffeine", "--force")
|
||||||
|
end
|
||||||
}.not_to raise_error
|
}.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe "brew bundle", :integration_test, :needs_test_cmd_taps do
|
describe "brew bundle", :integration_test, :needs_test_cmd_taps do
|
||||||
describe "check" do
|
describe "check" do
|
||||||
it "checks if a Brewfile's dependencies are satisfied" do
|
it "checks if a Brewfile's dependencies are satisfied", :needs_network do
|
||||||
setup_remote_tap "homebrew/bundle"
|
setup_remote_tap "homebrew/bundle"
|
||||||
|
|
||||||
HOMEBREW_REPOSITORY.cd do
|
HOMEBREW_REPOSITORY.cd do
|
||||||
|
@ -6,9 +6,7 @@ describe "brew pull", :integration_test do
|
|||||||
.and be_a_failure
|
.and be_a_failure
|
||||||
end
|
end
|
||||||
|
|
||||||
it "fetches a patch from a GitHub commit or pull request and applies it" do
|
it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do
|
||||||
skip "Requires network connection." if ENV["HOMEBREW_NO_GITHUB_API"]
|
|
||||||
|
|
||||||
CoreTap.instance.path.cd do
|
CoreTap.instance.path.cd do
|
||||||
shutup do
|
shutup do
|
||||||
system "git", "init"
|
system "git", "init"
|
||||||
|
@ -139,7 +139,7 @@ describe Homebrew::MissingFormula do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "::deleted_reason" do
|
context "::deleted_reason" do
|
||||||
subject { described_class.deleted_reason(formula) }
|
subject { described_class.deleted_reason(formula, silent: true) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Tap.clear_cache
|
Tap.clear_cache
|
||||||
|
@ -61,6 +61,10 @@ RSpec.configure do |config|
|
|||||||
skip "Python not installed." unless which("python")
|
skip "Python not installed." unless which("python")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.before(:each, :needs_network) do
|
||||||
|
skip "Requires network connection." unless ENV["HOMEBREW_TEST_ONLINE"]
|
||||||
|
end
|
||||||
|
|
||||||
config.around(:each) do |example|
|
config.around(:each) do |example|
|
||||||
begin
|
begin
|
||||||
TEST_DIRECTORIES.each(&:mkpath)
|
TEST_DIRECTORIES.each(&:mkpath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user