aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-01-22 23:17:09 +0100
committerAlyssa Ross2017-01-23 12:31:25 +0000
commitb7dc56a8aa08e5783072ac728ed08ca597262835 (patch)
tree07b0f05cb7db3786d9ce60709037f4ebeab322e9 /Library
parent7d131de57dac25dbb7cf9a8f986c291de87f7e65 (diff)
downloadbrew-b7dc56a8aa08e5783072ac728ed08ca597262835.tar.bz2
Delete with_environment from cask tests.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/spec/cask/cli_spec.rb16
-rw-r--r--Library/Homebrew/cask/test/cask/dsl_test.rb6
-rw-r--r--Library/Homebrew/cask/test/test_helper.rb2
3 files changed, 13 insertions, 11 deletions
diff --git a/Library/Homebrew/cask/spec/cask/cli_spec.rb b/Library/Homebrew/cask/spec/cask/cli_spec.rb
index 9964275f1..6b2313a41 100644
--- a/Library/Homebrew/cask/spec/cask/cli_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/cli_spec.rb
@@ -39,17 +39,17 @@ describe Hbc::CLI do
end
it "respects the env variable when choosing what appdir to create" do
- with_environment "HOMEBREW_CASK_OPTS" => "--appdir=/custom/appdir" do
- expect(Hbc).to receive(:appdir=).with(Pathname("/custom/appdir"))
- described_class.process("noop")
- end
+ allow(ENV).to receive(:[])
+ allow(ENV).to receive(:[]).with("HOMEBREW_CASK_OPTS").and_return("--appdir=/custom/appdir")
+ expect(Hbc).to receive(:appdir=).with(Pathname.new("/custom/appdir"))
+ described_class.process("noop")
end
it "respects the env variable when choosing a non-default Caskroom location" do
- with_environment "HOMEBREW_CASK_OPTS" => "--caskroom=/custom/caskdir" do
- expect(Hbc).to receive(:caskroom=).with(Pathname("/custom/caskdir"))
- described_class.process("noop")
- end
+ allow(ENV).to receive(:[])
+ allow(ENV).to receive(:[]).with("HOMEBREW_CASK_OPTS").and_return("--caskroom=/custom/caskdir")
+ expect(Hbc).to receive(:caskroom=).with(Pathname.new("/custom/caskdir"))
+ described_class.process("noop")
end
it "exits with a status of 1 when something goes wrong" do
diff --git a/Library/Homebrew/cask/test/cask/dsl_test.rb b/Library/Homebrew/cask/test/cask/dsl_test.rb
index 96d24a1a1..0ea928f40 100644
--- a/Library/Homebrew/cask/test/cask/dsl_test.rb
+++ b/Library/Homebrew/cask/test/cask/dsl_test.rb
@@ -69,7 +69,11 @@ describe Hbc::DSL do
end
it "may use deprecated DSL version hash syntax" do
- with_environment "HOMEBREW_DEVELOPER" => nil do
+ stub = proc do |arg|
+ arg == "HOMEBREW_DEVELOPER" ? nil : ENV[arg]
+ end
+
+ ENV.stub :[], stub do
shutup do
test_cask = Hbc.load("with-dsl-version")
test_cask.token.must_equal "with-dsl-version"
diff --git a/Library/Homebrew/cask/test/test_helper.rb b/Library/Homebrew/cask/test/test_helper.rb
index 275ede304..7315839f5 100644
--- a/Library/Homebrew/cask/test/test_helper.rb
+++ b/Library/Homebrew/cask/test/test_helper.rb
@@ -13,9 +13,7 @@ require "global"
# add Homebrew-Cask to load path
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s)
-require "test/support/helper/env"
require "test/support/helper/shutup"
-include Test::Helper::Env
include Test::Helper::Shutup
def sudo(*args)