test: test for IsEnvSet

This commit is contained in:
Mitchell Hashimoto 2015-10-07 22:54:27 -04:00
parent ed4df21c85
commit cc8cdafdc3
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
require "pathname"
require "tmpdir"
require File.expand_path("../../../../base", __FILE__)
describe Vagrant::Action::Builtin::IsEnvSet do
let(:app) { lambda { |env| } }
let(:env) { { } }
describe "#call" do
it "sets result to true if it is set" do
env[:bar] = true
subject = described_class.new(app, env, :bar)
expect(app).to receive(:call).with(env)
subject.call(env)
expect(env[:result]).to be_true
end
it "sets result to false if it isn't set" do
subject = described_class.new(app, env, :bar)
expect(app).to receive(:call).with(env)
subject.call(env)
expect(env[:result]).to be_false
end
end
end