From 5eeae5c3f5c84dfcd1cd2fc6101c8c43b015e638 Mon Sep 17 00:00:00 2001
From: Brian Tatnall <btatnall@gmail.com>
Date: Tue, 30 Sep 2008 18:03:15 +0000
Subject: [PATCH] File::truncate should be able to truncate absolute paths.
 This issue raised its head in JRuby 1.1.4: http://jira.codehaus.org/browse/JRUBY-3025

---
 spec/frozen/1.8/core/file/truncate_spec.rb |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/spec/frozen/1.8/core/file/truncate_spec.rb b/spec/frozen/1.8/core/file/truncate_spec.rb
index 76bfbba..4ebbaaf 100644
--- a/spec/frozen/1.8/core/file/truncate_spec.rb
+++ b/spec/frozen/1.8/core/file/truncate_spec.rb
@@ -54,6 +54,16 @@ describe "File.truncate" do
     IO.read(@name).should == "1234567890"
   end
 
+  it "truncates an absolute pathname file" do
+    platform_is_not :windows do
+      absolute_pathname_file = "/tmp/#{@name}"
+      File.open(absolute_pathname_file,"w") { |f| f.write("1234567890") }
+      File.truncate(absolute_pathname_file, 5)
+      File.size(absolute_pathname_file).should == 5
+      File.delete(absolute_pathname_file) if File.exist?(absolute_pathname_file)
+    end
+  end
+
   it "raises an Errno::ENOENT if the file does not exist" do
     not_existing_file = "file-does-not-exist-for-sure.txt"
 
-- 
1.5.4.3

