diff options
Diffstat (limited to 'spec/ruby/core/file/ctime_spec.rb')
| -rw-r--r-- | spec/ruby/core/file/ctime_spec.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/ruby/core/file/ctime_spec.rb b/spec/ruby/core/file/ctime_spec.rb index c39775fcdd..cf37d1f4ee 100644 --- a/spec/ruby/core/file/ctime_spec.rb +++ b/spec/ruby/core/file/ctime_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../spec_helper', __FILE__) +require_relative '../../spec_helper' describe "File.ctime" do before :each do @@ -11,17 +11,20 @@ describe "File.ctime" 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)." do File.ctime(@file) - File.ctime(@file).should be_kind_of(Time) + File.ctime(@file).should.is_a?(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) + supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10) if supports_subseconds != 0 File.ctime(__FILE__).usec.should > 0 else File.ctime(__FILE__).usec.should == 0 end + rescue Errno::ENOENT => e + # Windows don't have stat command. + skip e.message end end @@ -30,7 +33,7 @@ describe "File.ctime" do end it "raises an Errno::ENOENT exception if the file is not found" do - lambda { File.ctime('bogus') }.should raise_error(Errno::ENOENT) + -> { File.ctime('bogus') }.should.raise(Errno::ENOENT) end end @@ -46,6 +49,6 @@ describe "File#ctime" 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)." do @file.ctime - @file.ctime.should be_kind_of(Time) + @file.ctime.should.is_a?(Time) end end |
