Tab => Spaces
This commit is contained in:
parent
bfcc0d3939
commit
c25ff5300a
|
@ -51,15 +51,16 @@ module Vagrant
|
|||
|
||||
def with_tempfile
|
||||
logger.info "Creating tempfile for storing box file..."
|
||||
# create, write only, fail if the file exists
|
||||
File.open(file_temp_path, File::WRONLY|File::EXCL|File::CREAT) do |tempfile|
|
||||
yield tempfile
|
||||
|
||||
# create, write only, fail if the file exists
|
||||
File.open(file_temp_path, File::WRONLY | File::EXCL | File::CREAT) do |tempfile|
|
||||
yield tempfile
|
||||
end
|
||||
end
|
||||
|
||||
def file_temp_path
|
||||
File.join(@runner.env.tmp_path, BASENAME + Time.now.to_i.to_s)
|
||||
end
|
||||
def file_temp_path
|
||||
File.join(@runner.env.tmp_path, BASENAME + Time.now.to_i.to_s)
|
||||
end
|
||||
|
||||
def download_to(f)
|
||||
logger.info "Copying box to temporary location..."
|
||||
|
|
|
@ -82,7 +82,7 @@ class DownloadBoxActionTest < Test::Unit::TestCase
|
|||
context "tempfile" do
|
||||
should "create a tempfile in the vagrant tmp directory" do
|
||||
File.expects(:open).with { |name, bitmask|
|
||||
name =~ /#{Vagrant::Actions::Box::Download::BASENAME}/ && name =~ /#{@runner.env.tmp_path}/
|
||||
name =~ /#{Vagrant::Actions::Box::Download::BASENAME}/ && name =~ /#{@runner.env.tmp_path}/
|
||||
}.once
|
||||
@action.with_tempfile
|
||||
end
|
||||
|
|
|
@ -153,13 +153,13 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
|
||||
context "loading the root path" do
|
||||
setup do
|
||||
@env.cwd = "/foo"
|
||||
@env.cwd = "/foo"
|
||||
end
|
||||
|
||||
should "default the path to the cwd instance var if nil" do
|
||||
@path = mock("path")
|
||||
@path.stubs(:root?).returns(true)
|
||||
File.expects(:expand_path).with(@env.cwd).returns(@env.cwd)
|
||||
File.expects(:expand_path).with(@env.cwd).returns(@env.cwd)
|
||||
Pathname.expects(:new).with(@env.cwd).returns(@path)
|
||||
@env.load_root_path!(nil)
|
||||
end
|
||||
|
@ -182,7 +182,7 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
|
||||
search_seq = sequence("search_seq")
|
||||
paths.each do |path|
|
||||
# NOTE File.expect(:expand_path) causes tests to hang in windows below is the interim solution
|
||||
# NOTE File.expect(:expand_path) causes tests to hang in windows below is the interim solution
|
||||
File.expects(:exist?).with("#{File.expand_path(path)}/#{Vagrant::Environment::ROOTFILE_NAME}").returns(false).in_sequence(search_seq)
|
||||
end
|
||||
|
||||
|
@ -205,7 +205,7 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "should set the path for the rootfile" do
|
||||
# NOTE File.expect(:expand_path) causes tests to hang in windows below is the interim solution
|
||||
# NOTE File.expect(:expand_path) causes tests to hang in windows below is the interim solution
|
||||
path = File.expand_path("/foo")
|
||||
File.expects(:exist?).with("#{path}/#{Vagrant::Environment::ROOTFILE_NAME}").returns(true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue