From cf93efca2d2fcc39b9a138de4446766049462d01 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 16 Nov 2016 13:27:34 -0800 Subject: [PATCH] Update tests for new information and cleaning method --- .../commands/plugin/action/update_gems_test.rb | 2 ++ test/unit/vagrant/plugin/manager_test.rb | 4 ++++ test/unit/vagrant/plugin/state_file_test.rb | 11 ++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/unit/plugins/commands/plugin/action/update_gems_test.rb b/test/unit/plugins/commands/plugin/action/update_gems_test.rb index 50e56267b..a3b4661c2 100644 --- a/test/unit/plugins/commands/plugin/action/update_gems_test.rb +++ b/test/unit/plugins/commands/plugin/action/update_gems_test.rb @@ -18,12 +18,14 @@ describe VagrantPlugins::CommandPlugin::Action::UpdateGems do describe "#call" do it "should update all plugins if none are specified" do expect(manager).to receive(:update_plugins).with([]).once.and_return([]) + expect(manager).to receive(:installed_plugins).twice.and_return({}) expect(app).to receive(:call).with(env).once subject.call(env) end it "should update specified plugins" do expect(manager).to receive(:update_plugins).with(["foo"]).once.and_return([]) + expect(manager).to receive(:installed_plugins).twice.and_return({}) expect(app).to receive(:call).with(env).once env[:plugin_name] = ["foo"] diff --git a/test/unit/vagrant/plugin/manager_test.rb b/test/unit/vagrant/plugin/manager_test.rb index f328d9ea2..da94c6ea6 100644 --- a/test/unit/vagrant/plugin/manager_test.rb +++ b/test/unit/vagrant/plugin/manager_test.rb @@ -34,6 +34,7 @@ describe Vagrant::Plugin::Manager do expect(plugins).to have_key("foo") expect(local).to be_false }.and_return(specs) + expect(bundler).to receive(:clean) result = subject.install_plugin("foo") @@ -70,6 +71,7 @@ describe Vagrant::Plugin::Manager do ordered.and_return(local_spec) expect(bundler).not_to receive(:install) + expect(bundler).to receive(:clean) subject.install_plugin(name) @@ -95,6 +97,7 @@ describe Vagrant::Plugin::Manager do expect(plugins["foo"]["gem_version"]).to eql(">= 0.1.0") expect(local).to be_false }.and_return(specs) + expect(bundler).to receive(:clean) subject.install_plugin("foo", version: ">= 0.1.0") @@ -109,6 +112,7 @@ describe Vagrant::Plugin::Manager do expect(plugins["foo"]["gem_version"]).to eql("0.1.0") expect(local).to be_false }.and_return(specs) + expect(bundler).to receive(:clean) subject.install_plugin("foo", version: "0.1.0") diff --git a/test/unit/vagrant/plugin/state_file_test.rb b/test/unit/vagrant/plugin/state_file_test.rb index a0fbccf66..ec50f3cba 100644 --- a/test/unit/vagrant/plugin/state_file_test.rb +++ b/test/unit/vagrant/plugin/state_file_test.rb @@ -26,11 +26,12 @@ describe Vagrant::Plugin::StateFile do plugins = instance.installed_plugins expect(plugins.length).to eql(1) expect(plugins["foo"]).to eql({ - "ruby_version" => RUBY_VERSION, - "vagrant_version" => Vagrant::VERSION, - "gem_version" => "", - "require" => "", - "sources" => [], + "ruby_version" => RUBY_VERSION, + "vagrant_version" => Vagrant::VERSION, + "gem_version" => "", + "require" => "", + "sources" => [], + "installed_gem_version" => nil, }) end