Update tests for new information and cleaning method

This commit is contained in:
Chris Roberts 2016-11-16 13:27:34 -08:00
parent ae21c31a6c
commit cf93efca2d
3 changed files with 12 additions and 5 deletions

View File

@ -18,12 +18,14 @@ describe VagrantPlugins::CommandPlugin::Action::UpdateGems do
describe "#call" do describe "#call" do
it "should update all plugins if none are specified" 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(:update_plugins).with([]).once.and_return([])
expect(manager).to receive(:installed_plugins).twice.and_return({})
expect(app).to receive(:call).with(env).once expect(app).to receive(:call).with(env).once
subject.call(env) subject.call(env)
end end
it "should update specified plugins" do it "should update specified plugins" do
expect(manager).to receive(:update_plugins).with(["foo"]).once.and_return([]) 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 expect(app).to receive(:call).with(env).once
env[:plugin_name] = ["foo"] env[:plugin_name] = ["foo"]

View File

@ -34,6 +34,7 @@ describe Vagrant::Plugin::Manager do
expect(plugins).to have_key("foo") expect(plugins).to have_key("foo")
expect(local).to be_false expect(local).to be_false
}.and_return(specs) }.and_return(specs)
expect(bundler).to receive(:clean)
result = subject.install_plugin("foo") result = subject.install_plugin("foo")
@ -70,6 +71,7 @@ describe Vagrant::Plugin::Manager do
ordered.and_return(local_spec) ordered.and_return(local_spec)
expect(bundler).not_to receive(:install) expect(bundler).not_to receive(:install)
expect(bundler).to receive(:clean)
subject.install_plugin(name) subject.install_plugin(name)
@ -95,6 +97,7 @@ describe Vagrant::Plugin::Manager do
expect(plugins["foo"]["gem_version"]).to eql(">= 0.1.0") expect(plugins["foo"]["gem_version"]).to eql(">= 0.1.0")
expect(local).to be_false expect(local).to be_false
}.and_return(specs) }.and_return(specs)
expect(bundler).to receive(:clean)
subject.install_plugin("foo", version: ">= 0.1.0") 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(plugins["foo"]["gem_version"]).to eql("0.1.0")
expect(local).to be_false expect(local).to be_false
}.and_return(specs) }.and_return(specs)
expect(bundler).to receive(:clean)
subject.install_plugin("foo", version: "0.1.0") subject.install_plugin("foo", version: "0.1.0")

View File

@ -26,11 +26,12 @@ describe Vagrant::Plugin::StateFile do
plugins = instance.installed_plugins plugins = instance.installed_plugins
expect(plugins.length).to eql(1) expect(plugins.length).to eql(1)
expect(plugins["foo"]).to eql({ expect(plugins["foo"]).to eql({
"ruby_version" => RUBY_VERSION, "ruby_version" => RUBY_VERSION,
"vagrant_version" => Vagrant::VERSION, "vagrant_version" => Vagrant::VERSION,
"gem_version" => "", "gem_version" => "",
"require" => "", "require" => "",
"sources" => [], "sources" => [],
"installed_gem_version" => nil,
}) })
end end