From 3fe785ab72dc46fccd09532fbd7ef87889fef9ab Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 3 Oct 2010 18:45:09 -0700 Subject: [PATCH] Removed `mock_vm` test helper, which is unnecessary --- test/test_helper.rb | 9 --------- test/vagrant/provisioners/chef_server_test.rb | 3 +-- test/vagrant/provisioners/chef_solo_test.rb | 3 +-- test/vagrant/provisioners/chef_test.rb | 3 +-- test/vagrant/ssh_test.rb | 4 +--- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 1774ff89d..35a5036b4 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -23,15 +23,6 @@ I18n.load_path << File.expand_path("../locales/en.yml", __FILE__) class Test::Unit::TestCase include Vagrant::TestHelpers - # Sets up the mocks for a VM - def mock_vm(env=nil) - env ||= vagrant_env - vm = Vagrant::VM.new - vm.stubs(:env).returns(env) - vm.stubs(:ssh).returns(Vagrant::SSH.new(vm.env)) - vm - end - # Sets up the mocks and stubs for a downloader def mock_downloader(downloader_klass) tempfile = mock("tempfile") diff --git a/test/vagrant/provisioners/chef_server_test.rb b/test/vagrant/provisioners/chef_server_test.rb index ce425494a..fb67beddd 100644 --- a/test/vagrant/provisioners/chef_server_test.rb +++ b/test/vagrant/provisioners/chef_server_test.rb @@ -2,8 +2,7 @@ require "test_helper" class ChefServerProvisionerTest < Test::Unit::TestCase setup do - @action_env = Vagrant::Action::Environment.new(vagrant_env) - @action_env.env.vm = mock_vm + @action_env = Vagrant::Action::Environment.new(vagrant_env.vms[:default].env) @action = Vagrant::Provisioners::ChefServer.new(@action_env) @env = @action.env diff --git a/test/vagrant/provisioners/chef_solo_test.rb b/test/vagrant/provisioners/chef_solo_test.rb index 5271ab91d..7160756cc 100644 --- a/test/vagrant/provisioners/chef_solo_test.rb +++ b/test/vagrant/provisioners/chef_solo_test.rb @@ -2,8 +2,7 @@ require "test_helper" class ChefSoloProvisionerTest < Test::Unit::TestCase setup do - @action_env = Vagrant::Action::Environment.new(vagrant_env) - @action_env.env.vm = mock_vm + @action_env = Vagrant::Action::Environment.new(vagrant_env.vms[:default].env) @action = Vagrant::Provisioners::ChefSolo.new(@action_env) @env = @action.env diff --git a/test/vagrant/provisioners/chef_test.rb b/test/vagrant/provisioners/chef_test.rb index 29a8ec6bf..fd742e2ad 100644 --- a/test/vagrant/provisioners/chef_test.rb +++ b/test/vagrant/provisioners/chef_test.rb @@ -2,8 +2,7 @@ require "test_helper" class ChefProvisionerTest < Test::Unit::TestCase setup do - @action_env = Vagrant::Action::Environment.new(vagrant_env) - @action_env.env.vm = mock_vm + @action_env = Vagrant::Action::Environment.new(vagrant_env.vms[:default].env) @action = Vagrant::Provisioners::Chef.new(@action_env) @env = @action.env diff --git a/test/vagrant/ssh_test.rb b/test/vagrant/ssh_test.rb index e9742efc3..6aa970dd0 100644 --- a/test/vagrant/ssh_test.rb +++ b/test/vagrant/ssh_test.rb @@ -2,12 +2,10 @@ require "test_helper" class SshTest < Test::Unit::TestCase def mock_ssh - @env = vagrant_env + @env = vagrant_env.vms[:default].env @network_adapters = [] @vm = mock("vm") @vm.stubs(:network_adapters).returns(@network_adapters) - - @env.stubs(:vm).returns(mock_vm(@env)) @env.vm.stubs(:vm).returns(@vm) @ssh = Vagrant::SSH.new(@env)