Updated RubySpec source to b897f30c.
[rbx.git] / spec / frozen / 1.8 / core / file / atime_spec.rb
blobc1b3f2f400aef2168677c431e4c93875e3a1c57a
1 require File.dirname(__FILE__) + '/../../spec_helper'
3 describe "File.atime" do
4   before :each do
5     @file = tmp('test.txt')
6     File.open(@file, "w") {} # touch
7   end
9   after :each do
10     File.delete(@file) if File.exist?(@file)
11   end
13   it "returns the last access time for the named file as a Time object" do
14     File.atime(@file)
15     File.atime(@file).should be_kind_of(Time)
16   end
18   it "raises an Errno::ENOENT exception if the file is not found" do
19     lambda { File.atime('a_fake_file') }.should raise_error(Errno::ENOENT)
20   end
21 end
23 describe "File#atime" do
24   before :each do
25     @name = File.expand_path(__FILE__)
26     @file = File.open(@name)
27   end
29   after :each do
30     @file.close rescue nil
31   end
33   it "returns the last access time to self" do
34     @file.atime
35     @file.atime.should be_kind_of(Time)
36   end
37 end