`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
# `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;

View File

@ -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