commands/plugin: add more tests for installgem

This commit is contained in:
Mitchell Hashimoto 2014-01-06 10:55:34 -08:00
parent 3cefcda1e3
commit 198e142794
2 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ describe VagrantPlugins::CommandPlugin::Action::InstallGem do
it "should install the plugin" do
spec = Gem::Specification.new
manager.should_receive(:install_plugin).with(
"foo", version: nil, require: nil, sources: nil).once.and_return(spec)
"foo", version: nil, require: nil, sources: nil, verbose: false).once.and_return(spec)
app.should_receive(:call).with(env).once
@ -29,7 +29,7 @@ describe VagrantPlugins::CommandPlugin::Action::InstallGem do
it "should specify the version if given" do
spec = Gem::Specification.new
manager.should_receive(:install_plugin).with(
"foo", version: "bar", require: nil, sources: nil).once.and_return(spec)
"foo", version: "bar", require: nil, sources: nil, verbose: false).once.and_return(spec)
app.should_receive(:call).with(env).once
@ -41,7 +41,7 @@ describe VagrantPlugins::CommandPlugin::Action::InstallGem do
it "should specify the entrypoint if given" do
spec = Gem::Specification.new
manager.should_receive(:install_plugin).with(
"foo", version: "bar", require: "baz", sources: nil).once.and_return(spec)
"foo", version: "bar", require: "baz", sources: nil, verbose: false).once.and_return(spec)
app.should_receive(:call).with(env).once
@ -54,7 +54,7 @@ describe VagrantPlugins::CommandPlugin::Action::InstallGem do
it "should specify the sources if given" do
spec = Gem::Specification.new
manager.should_receive(:install_plugin).with(
"foo", version: nil, require: nil, sources: ["foo"]).once.and_return(spec)
"foo", version: nil, require: nil, sources: ["foo"], verbose: false).once.and_return(spec)
app.should_receive(:call).with(env).once

View File

@ -32,8 +32,9 @@ describe Vagrant::Plugin::Manager do
it "installs the plugin and adds it to the state file" do
specs = Array.new(5) { Gem::Specification.new }
specs[3].name = "foo"
bundler.should_receive(:install).once.with do |plugins|
bundler.should_receive(:install).once.with do |plugins, local|
expect(plugins).to have_key("foo")
expect(local).to be_false
end.and_return(specs)
result = subject.install_plugin("foo")