From cc8cdafdc32f4b6e627421e4c06fda1e009f5886 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 7 Oct 2015 22:54:27 -0400 Subject: [PATCH] test: test for IsEnvSet --- .../vagrant/action/builtin/is_env_set_test.rb | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/unit/vagrant/action/builtin/is_env_set_test.rb diff --git a/test/unit/vagrant/action/builtin/is_env_set_test.rb b/test/unit/vagrant/action/builtin/is_env_set_test.rb new file mode 100644 index 000000000..56eafa956 --- /dev/null +++ b/test/unit/vagrant/action/builtin/is_env_set_test.rb @@ -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