Get rid of "mock_action_data" use "action_env" instead
This commit is contained in:
parent
16f3a3face
commit
a0ed4d0da8
|
@ -37,20 +37,12 @@ class Test::Unit::TestCase
|
|||
vm
|
||||
end
|
||||
|
||||
def mock_action_data(v_env=nil)
|
||||
v_env ||= vagrant_env
|
||||
app = lambda { |env| }
|
||||
env = Vagrant::Action::Environment.new(v_env)
|
||||
env["vagrant.test"] = true
|
||||
[app, env]
|
||||
end
|
||||
|
||||
# Sets up the mocks and stubs for a downloader
|
||||
def mock_downloader(downloader_klass)
|
||||
tempfile = mock("tempfile")
|
||||
tempfile.stubs(:write)
|
||||
|
||||
_, env = mock_action_data
|
||||
_, env = action_env
|
||||
[downloader_klass.new(env), tempfile]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class SetEnvActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::Env::Set
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
@env.clear
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class PackageGeneralActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::General::Package
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class BootVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Boot
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:ssh).returns(mock("ssh"))
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class CleanMachineFolderVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::CleanMachineFolder
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@instance = @klass.new(@app, @env)
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ClearForwardedPortsVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::ClearForwardedPorts
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ClearNFSExportsActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::ClearNFSExports
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
@env.env.stubs(:host).returns(Vagrant::Hosts::Base.new(@env))
|
||||
|
||||
@instance = @klass.new(@app, @env)
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ClearSharedFoldersVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::ClearSharedFolders
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class CustomizeVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Customize
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
@instance = @klass.new(@app, @env)
|
||||
|
||||
@vm = mock("vm")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class DestroyVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Destroy
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class DestroyUnusedNetworkInterfacesVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::DestroyUnusedNetworkInterfaces
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class DisableNetworksVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::DisableNetworks
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env.env.stubs(:vm).returns(@vm)
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class DiscardStateVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::DiscardState
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ExportVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Export
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,11 +3,11 @@ require "test_helper"
|
|||
class ForwardPortsHelpersVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Class.new do
|
||||
include Vagrant::Action::VM::ForwardPortsHelpers
|
||||
def initialize(env); @env = env; end
|
||||
end
|
||||
|
||||
@klass.send(:include, Vagrant::Action::VM::ForwardPortsHelpers)
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ForwardPortsVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::ForwardPorts
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class HaltVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Halt
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ImportVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Import
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
@instance = @klass.new(@app, @env)
|
||||
|
||||
ovf_file = "foo"
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class MatchMACAddressVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::MatchMACAddress
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class NetworkVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Network
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -2,9 +2,11 @@ require "test_helper"
|
|||
|
||||
class NFSHelpersVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Class.new
|
||||
@klass.send(:include, Vagrant::Action::VM::NFSHelpers)
|
||||
@app, @env = mock_action_data
|
||||
@klass = Class.new do
|
||||
include Vagrant::Action::VM::NFSHelpers
|
||||
end
|
||||
|
||||
@app, @env = action_env
|
||||
|
||||
@instance = @klass.new
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class PackageVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Package
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
@env["export.temp_dir"] = "foo"
|
||||
|
||||
@instance = @klass.new(@app, @env)
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class PackageVagrantfileVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::PackageVagrantfile
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ProvisionVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Provision
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ResumeVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Resume
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class ShareFoldersVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::ShareFolders
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@vm.stubs(:name).returns("foo")
|
||||
|
|
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||
class SuspendVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::Suspend
|
||||
@app, @env = mock_action_data
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env["vm"] = @vm
|
||||
|
|
Loading…
Reference in New Issue