`vagrant ssh` with new Environment

This commit is contained in:
Mitchell Hashimoto 2010-03-19 16:47:38 -07:00
parent 62de77132c
commit 259a3a3836
2 changed files with 11 additions and 6 deletions

View File

@ -113,9 +113,9 @@ msg
# This command requires that an instance already be brought up with # This command requires that an instance already be brought up with
# `vagrant up`. # `vagrant up`.
def ssh def ssh
Env.load! env = Environment.load!
Env.require_persisted_vm env.require_persisted_vm
SSH.connect env.ssh.connect
end end
# Halts a running vagrant instance. This forcibly halts the instance; # Halts a running vagrant instance. This forcibly halts the instance;

View File

@ -120,16 +120,21 @@ class CommandsTest < Test::Unit::TestCase
context "ssh" do context "ssh" do
setup 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 end
should "require a persisted VM" do should "require a persisted VM" do
Vagrant::Env.expects(:require_persisted_vm).once @env.expects(:require_persisted_vm).once
Vagrant::Commands.ssh Vagrant::Commands.ssh
end end
should "connect to SSH" do should "connect to SSH" do
Vagrant::SSH.expects(:connect).once @env.ssh.expects(:connect).once
Vagrant::Commands.ssh Vagrant::Commands.ssh
end end
end end