commands/plugin: add tests for UpdateGems

This commit is contained in:
Mitchell Hashimoto 2014-01-05 22:37:29 -08:00
parent 0117521744
commit 35d711c91b
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
require File.expand_path("../../../../../base", __FILE__)
describe VagrantPlugins::CommandPlugin::Action::UpdateGems do
let(:app) { lambda { |env| } }
let(:env) {{
ui: Vagrant::UI::Silent.new
}}
let(:manager) { double("manager") }
subject { described_class.new(app, env) }
before do
Vagrant::Plugin::Manager.stub(instance: manager)
manager.stub(installed_specs: [])
end
describe "#call" do
it "should update all plugins if none are specified" do
manager.should_receive(:update_plugins).with([]).once.and_return([])
app.should_receive(:call).with(env).once
subject.call(env)
end
it "should update specified plugins" do
manager.should_receive(:update_plugins).with(["foo"]).once.and_return([])
app.should_receive(:call).with(env).once
env[:plugin_name] = ["foo"]
subject.call(env)
end
end
end