From 35d711c91b444a55f9b2fe8cd44815d8548fafec Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Jan 2014 22:37:29 -0800 Subject: [PATCH] commands/plugin: add tests for UpdateGems --- .../plugin/action/update_gems_test.rb | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/unit/plugins/commands/plugin/action/update_gems_test.rb diff --git a/test/unit/plugins/commands/plugin/action/update_gems_test.rb b/test/unit/plugins/commands/plugin/action/update_gems_test.rb new file mode 100644 index 000000000..f92b26990 --- /dev/null +++ b/test/unit/plugins/commands/plugin/action/update_gems_test.rb @@ -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