1 require File.dirname(__FILE__) + '/../../spec_helper'
3 describe "File.mtime" do
5 @filename = tmp('i_exist')
6 File.open(@filename, 'w') { @mtime = Time.now }
10 File.delete(@filename) if File.exist?(@filename)
13 it "returns the modification Time of the file" do
14 File.mtime(@filename).class.should == Time
15 File.mtime(@filename).should be_close(@mtime, 2.0)
18 it "raises an Errno::ENOENT exception if the file is not found" do
19 lambda { File.mtime('bogus') }.should raise_error(Errno::ENOENT)
23 describe "File#mtime" do
25 @filename = tmp('i_exist')
26 @f = File.open(@filename, 'w')
30 File.delete(@filename) if File.exist?(@filename)
33 it "returns the modification Time of the file" do
34 @f.mtime.class.should == Time