From 259a3a3836059bc11269793069179959ea3ab863 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 19 Mar 2010 16:47:38 -0700 Subject: [PATCH] `vagrant ssh` with new Environment --- lib/vagrant/commands.rb | 6 +++--- test/vagrant/commands_test.rb | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/vagrant/commands.rb b/lib/vagrant/commands.rb index 3112e196d..476b43426 100644 --- a/lib/vagrant/commands.rb +++ b/lib/vagrant/commands.rb @@ -113,9 +113,9 @@ msg # This command requires that an instance already be brought up with # `vagrant up`. def ssh - Env.load! - Env.require_persisted_vm - SSH.connect + env = Environment.load! + env.require_persisted_vm + env.ssh.connect end # Halts a running vagrant instance. This forcibly halts the instance; diff --git a/test/vagrant/commands_test.rb b/test/vagrant/commands_test.rb index 61fba7a55..aba6b7811 100644 --- a/test/vagrant/commands_test.rb +++ b/test/vagrant/commands_test.rb @@ -120,16 +120,21 @@ class CommandsTest < Test::Unit::TestCase context "ssh" do setup do - Vagrant::SSH.stubs(:connect) + @env.ssh.stubs(:connect) + end + + should "load the current environment" do + Vagrant::Environment.expects(:load!).once.returns(@env) + Vagrant::Commands.ssh end should "require a persisted VM" do - Vagrant::Env.expects(:require_persisted_vm).once + @env.expects(:require_persisted_vm).once Vagrant::Commands.ssh end should "connect to SSH" do - Vagrant::SSH.expects(:connect).once + @env.ssh.expects(:connect).once Vagrant::Commands.ssh end end