2014-01-06 06:37:29 +00:00
|
|
|
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
|
2017-08-04 17:10:58 +00:00
|
|
|
allow(Vagrant::Plugin::Manager).to receive(:instance).and_return(manager)
|
|
|
|
allow(manager).to receive(:installed_specs).and_return([])
|
2014-01-06 06:37:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#call" do
|
|
|
|
it "should update all plugins if none are specified" do
|
2014-03-14 15:02:07 +00:00
|
|
|
expect(manager).to receive(:update_plugins).with([]).once.and_return([])
|
2016-11-16 21:27:34 +00:00
|
|
|
expect(manager).to receive(:installed_plugins).twice.and_return({})
|
2014-03-14 15:02:07 +00:00
|
|
|
expect(app).to receive(:call).with(env).once
|
2014-01-06 06:37:29 +00:00
|
|
|
subject.call(env)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should update specified plugins" do
|
2014-03-14 15:02:07 +00:00
|
|
|
expect(manager).to receive(:update_plugins).with(["foo"]).once.and_return([])
|
2016-11-16 21:27:34 +00:00
|
|
|
expect(manager).to receive(:installed_plugins).twice.and_return({})
|
2014-03-14 15:02:07 +00:00
|
|
|
expect(app).to receive(:call).with(env).once
|
2014-01-06 06:37:29 +00:00
|
|
|
|
|
|
|
env[:plugin_name] = ["foo"]
|
|
|
|
subject.call(env)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|