Removed final global test helper from test/test_helper.rb

This commit is contained in:
Mitchell Hashimoto 2010-10-03 18:48:41 -07:00
parent 3fe785ab72
commit 12b769ce14
5 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,6 @@
## 0.6.4 (unreleased)
- Added method to `TestHelpers` to assist with testing new downloaders.
- `up --no-provision` works again. This disables provisioning during the
boot process.
- Action warden doesn't do recovery process on `SystemExit` exceptions,

View File

@ -55,6 +55,19 @@ module Vagrant
result
end
# Returns an instantiated downloader with a mocked tempfile
# which can be passed into it.
#
# @param [Class] klass The downloader class
# @return [Array] Returns an array of `downloader` `tempfile`
def vagrant_mock_downloader(klass)
tempfile = mock("tempfile")
tempfile.stubs(:write)
_, env = action_env
[klass.new(env), tempfile]
end
# Returns a blank app (callable) and action environment with the
# given vagrant environment. This allows for testing of middlewares.
def action_env(v_env = nil)

View File

@ -22,14 +22,5 @@ I18n.load_path << File.expand_path("../locales/en.yml", __FILE__)
class Test::Unit::TestCase
include Vagrant::TestHelpers
# Sets up the mocks and stubs for a downloader
def mock_downloader(downloader_klass)
tempfile = mock("tempfile")
tempfile.stubs(:write)
_, env = action_env
[downloader_klass.new(env), tempfile]
end
end

View File

@ -2,7 +2,7 @@ require "test_helper"
class FileDownloaderTest < Test::Unit::TestCase
setup do
@downloader, @tempfile = mock_downloader(Vagrant::Downloaders::File)
@downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::File)
@uri = "foo.box"
end

View File

@ -2,7 +2,7 @@ require "test_helper"
class HttpDownloaderTest < Test::Unit::TestCase
setup do
@downloader, @tempfile = mock_downloader(Vagrant::Downloaders::HTTP)
@downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::HTTP)
@downloader.stubs(:report_progress)
@downloader.stubs(:complete_progress)
@uri = "http://google.com/"