From 564dff651e69bc216ba9434364994f16574d1524 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 18 Jul 2018 10:50:41 -0700 Subject: [PATCH] Add coverage on vagrantfile_name stubbing behavior --- test/unit/bin/vagrant_test.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/unit/bin/vagrant_test.rb b/test/unit/bin/vagrant_test.rb index df7cc0e0c..08edcb20e 100644 --- a/test/unit/bin/vagrant_test.rb +++ b/test/unit/bin/vagrant_test.rb @@ -121,7 +121,10 @@ describe "vagrant bin" do context "plugin commands" do let(:argv) { ["plugin"] } - before { allow(ENV).to receive(:[]=) } + before do + allow(ENV).to receive(:[]=) + allow(ENV).to receive(:[]) + end it "should unset vagrantfile" do expect(Vagrant::Environment).to receive(:new). @@ -152,5 +155,14 @@ describe "vagrant bin" do with(hash_excluding(vagrantfile_name: "")).and_return(env) end end + + context "with VAGRANT_LOCAL_PLUGINS_LOAD enabled" do + before { expect(ENV).to receive(:[]).with("VAGRANT_LOCAL_PLUGINS_LOAD").and_return("1") } + + it "should not unset vagrantfile" do + expect(Vagrant::Environment).to receive(:new). + with(hash_excluding(vagrantfile_name: "")).and_return(env) + end + end end end