diff --git a/lib/vagrant/actions/box/download.rb b/lib/vagrant/actions/box/download.rb index aedf53791..385ae451d 100644 --- a/lib/vagrant/actions/box/download.rb +++ b/lib/vagrant/actions/box/download.rb @@ -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..." diff --git a/test/vagrant/actions/box/download_test.rb b/test/vagrant/actions/box/download_test.rb index bb331eed6..f5c4f40f7 100644 --- a/test/vagrant/actions/box/download_test.rb +++ b/test/vagrant/actions/box/download_test.rb @@ -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 diff --git a/test/vagrant/environment_test.rb b/test/vagrant/environment_test.rb index 50374cc12..e5aae9bd5 100644 --- a/test/vagrant/environment_test.rb +++ b/test/vagrant/environment_test.rb @@ -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)