diff --git a/spec/rubyspec/core/file/atime_spec.rb b/spec/rubyspec/core/file/atime_spec.rb index 76e7fbd62a..3ef0e9ad4e 100644 --- a/spec/rubyspec/core/file/atime_spec.rb +++ b/spec/rubyspec/core/file/atime_spec.rb @@ -15,7 +15,7 @@ File.atime(@file).should be_kind_of(Time) end - platform_is :linux do + platform_is :linux, :windows do ## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed. it "returns the last access time for the named file with microseconds" do supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10) diff --git a/spec/rubyspec/core/file/ctime_spec.rb b/spec/rubyspec/core/file/ctime_spec.rb index c39775fcdd..a5791dcaed 100644 --- a/spec/rubyspec/core/file/ctime_spec.rb +++ b/spec/rubyspec/core/file/ctime_spec.rb @@ -14,7 +14,7 @@ File.ctime(@file).should be_kind_of(Time) end - platform_is :linux do + platform_is :linux, :windows do it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10) if supports_subseconds != 0 diff --git a/spec/rubyspec/core/file/mtime_spec.rb b/spec/rubyspec/core/file/mtime_spec.rb index 56b7e4464e..3a45f509a3 100644 --- a/spec/rubyspec/core/file/mtime_spec.rb +++ b/spec/rubyspec/core/file/mtime_spec.rb @@ -15,7 +15,7 @@ File.mtime(@filename).should be_close(@mtime, 2.0) end - platform_is :linux do + platform_is :linux, :windows do it "returns the modification Time of the file with microseconds" do supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10) if supports_subseconds != 0 diff --git a/spec/rubyspec/core/file/utime_spec.rb b/spec/rubyspec/core/file/utime_spec.rb index 73112420d1..fb4aff4ffe 100644 --- a/spec/rubyspec/core/file/utime_spec.rb +++ b/spec/rubyspec/core/file/utime_spec.rb @@ -16,21 +16,24 @@ it "sets the access and modification time of each file" do File.utime(@atime, @mtime, @file1, @file2) - File.atime(@file1).to_i.should be_close(@atime.to_i, 2) - File.mtime(@file1).to_i.should be_close(@mtime.to_i, 2) - File.atime(@file2).to_i.should be_close(@atime.to_i, 2) - File.mtime(@file2).to_i.should be_close(@mtime.to_i, 2) + File.atime(@file1).should be_close(@atime, 0.0001) + File.mtime(@file1).should be_close(@mtime, 0.0001) + File.atime(@file2).should be_close(@atime, 0.0001) + File.mtime(@file2).should be_close(@mtime, 0.0001) end it "uses the current times if two nil values are passed" do File.utime(nil, nil, @file1, @file2) - File.atime(@file1).to_i.should be_close(Time.now.to_i, 2) - File.mtime(@file1).to_i.should be_close(Time.now.to_i, 2) - File.atime(@file2).to_i.should be_close(Time.now.to_i, 2) - File.mtime(@file2).to_i.should be_close(Time.now.to_i, 2) + tn = Time.now + File.atime(@file1).should be_close(tn, 0.0002) + File.mtime(@file1).should be_close(tn, 0.0002) + File.atime(@file2).should be_close(tn, 0.0002) + File.mtime(@file2).should be_close(tn, 0.0002) end + it "accepts an object that has a #to_path method" do File.utime(@atime, @mtime, mock_to_path(@file1), mock_to_path(@file2)) end end +