From 13e9f8037a6a94e4b24e0f6dda96e7a9b0dccb28 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 11 Jan 2014 08:59:13 -0800 Subject: [PATCH] test: get all the tests passing with new CLI changes --- .../commands/ssh_config/command_test.rb | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/test/unit/plugins/commands/ssh_config/command_test.rb b/test/unit/plugins/commands/ssh_config/command_test.rb index df862bd54..4f5c51459 100644 --- a/test/unit/plugins/commands/ssh_config/command_test.rb +++ b/test/unit/plugins/commands/ssh_config/command_test.rb @@ -1,14 +1,23 @@ require File.expand_path("../../../../base", __FILE__) -describe "VagrantPlugins::CommandSSHConfig::Command" do +require Vagrant.source_root.join("plugins/commands/ssh_config/command") + +describe VagrantPlugins::CommandSSHConfig::Command do include_context "unit" include_context "virtualbox" - let(:described_class) { Vagrant.plugin("2").manager.commands[:"ssh-config"] } + let(:iso_env) do + # We have to create a Vagrantfile so there is a root path + env = isolated_environment + env.vagrantfile("") + env.create_vagrant_env + end + + let(:guest) { double("guest") } + let(:host) { double("host") } + let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) } let(:argv) { [] } - let(:env) { Vagrant::Environment.new } - let(:machine) { double("Vagrant::Machine", :name => nil) } let(:ssh_info) {{ :host => "testhost.vagrant.dev", :port => 1234, @@ -18,17 +27,17 @@ describe "VagrantPlugins::CommandSSHConfig::Command" do :forward_x11 => false }} - subject { described_class.new(argv, env) } + subject { described_class.new(argv, iso_env) } before do + machine.stub(ssh_info: ssh_info) subject.stub(:with_target_vms) { |&block| block.call machine } end describe "execute" do it "prints out the ssh config for the given machine" do - machine.stub(:ssh_info) { ssh_info } subject.should_receive(:safe_puts).with(<<-SSHCONFIG) -Host vagrant +Host #{machine.name} HostName testhost.vagrant.dev User testuser Port 1234