Delete with_environment from cask tests.

This commit is contained in:
Markus Reiter 2017-01-22 23:17:09 +01:00 committed by Alyssa Ross
parent 7d131de57d
commit b7dc56a8aa
3 changed files with 13 additions and 11 deletions

View File

@ -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

View File

@ -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"

View File

@ -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)