diff options
Diffstat (limited to 'Library/Homebrew/test/support')
4 files changed, 28 insertions, 85 deletions
diff --git a/Library/Homebrew/test/support/helper/cask/install_helper.rb b/Library/Homebrew/test/support/helper/cask/install_helper.rb index d91b9ea57..1205512bf 100644 --- a/Library/Homebrew/test/support/helper/cask/install_helper.rb +++ b/Library/Homebrew/test/support/helper/cask/install_helper.rb @@ -1,42 +1,29 @@ module InstallHelper module_function - require "test/support/helper/shutup" - extend Test::Helper::Shutup - def self.install_without_artifacts(cask) Hbc::Installer.new(cask).tap do |i| - shutup do - i.download - i.extract_primary_container - end + i.download + i.extract_primary_container end end def self.install_without_artifacts_with_caskfile(cask) Hbc::Installer.new(cask).tap do |i| - shutup do - i.download - i.extract_primary_container - i.save_caskfile - end + i.download + i.extract_primary_container + i.save_caskfile end end def install_without_artifacts(cask) Hbc::Installer.new(cask).tap do |i| - shutup do - i.download - i.extract_primary_container - end + i.download + i.extract_primary_container end end def install_with_caskfile(cask) - Hbc::Installer.new(cask).tap do |i| - shutup do - i.save_caskfile - end - end + Hbc::Installer.new(cask).tap(&:save_caskfile) end end diff --git a/Library/Homebrew/test/support/helper/shutup.rb b/Library/Homebrew/test/support/helper/shutup.rb deleted file mode 100644 index fa5f08d31..000000000 --- a/Library/Homebrew/test/support/helper/shutup.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Test - module Helper - module Shutup - def shutup - if ENV.key?("VERBOSE_TESTS") - yield - else - begin - tmperr = $stderr.clone - tmpout = $stdout.clone - $stderr.reopen("/dev/null") - $stdout.reopen("/dev/null") - yield - ensure - $stderr.reopen(tmperr) - $stdout.reopen(tmpout) - tmperr.close - tmpout.close - end - end - end - end - end -end diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index cf9c13fb8..7bf2ce96a 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -171,22 +171,20 @@ RSpec.shared_context "integration test" do end def install_and_rename_coretap_formula(old_name, new_name) - shutup do - CoreTap.instance.path.cd do |tap_path| - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", - "#{old_name.capitalize} has not yet been renamed" + CoreTap.instance.path.cd do |tap_path| + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", + "#{old_name.capitalize} has not yet been renamed" - brew "install", old_name + brew "install", old_name - (tap_path/"Formula/#{old_name}.rb").unlink - (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name) + (tap_path/"Formula/#{old_name}.rb").unlink + (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name) - system "git", "add", "--all" - system "git", "commit", "-m", - "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" - end + system "git", "add", "--all" + system "git", "commit", "-m", + "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" end end diff --git a/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb index 1364c13a3..361179b9e 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb @@ -18,9 +18,7 @@ shared_examples Hbc::Staged do ["echo", "homebrew-cask", "rocks!"], ) - shutup do - staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) - end + staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) end it "can get the Info.plist file for the primary app" do @@ -34,9 +32,7 @@ shared_examples Hbc::Staged do ["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file], ) - shutup do - staged.plist_exec("Print CFBundleIdentifier") - end + staged.plist_exec("Print CFBundleIdentifier") end it "can set a key in the Info.plist file" do @@ -46,9 +42,7 @@ shared_examples Hbc::Staged do ["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file], ) - shutup do - staged.plist_set(":JVMOptions:JVMVersion", "1.6+") - end + staged.plist_set(":JVMOptions:JVMVersion", "1.6+") end it "can set the permissions of a file" do @@ -59,9 +53,7 @@ shared_examples Hbc::Staged do ["/bin/chmod", "-R", "--", "777", fake_pathname], ) - shutup do - staged.set_permissions(fake_pathname.to_s, "777") - end + staged.set_permissions(fake_pathname.to_s, "777") end it "can set the permissions of multiple files" do @@ -72,9 +64,7 @@ shared_examples Hbc::Staged do ["/bin/chmod", "-R", "--", "777", fake_pathname, fake_pathname], ) - shutup do - staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777") - end + staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777") end it "cannot set the permissions of a file that does not exist" do @@ -93,9 +83,7 @@ shared_examples Hbc::Staged do ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname], ) - shutup do - staged.set_ownership(fake_pathname.to_s) - end + staged.set_ownership(fake_pathname.to_s) end it "can set the ownership of multiple files" do @@ -108,9 +96,7 @@ shared_examples Hbc::Staged do ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname, fake_pathname], ) - shutup do - staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s]) - end + staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s]) end it "can set the ownership of a file with a different user and group" do @@ -122,9 +108,7 @@ shared_examples Hbc::Staged do ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "other_user:other_group", fake_pathname], ) - shutup do - staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group") - end + staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group") end it "cannot set the ownership of a file that does not exist" do @@ -132,8 +116,6 @@ shared_examples Hbc::Staged do fake_pathname = non_existent_path allow(staged).to receive(:Pathname).and_return(fake_pathname) - shutup do - staged.set_ownership(fake_pathname.to_s) - end + staged.set_ownership(fake_pathname.to_s) end end |
