Sha256: ba365ff973d8a3b202f7c56b51c4012d9d9151c9d525f18679d3bbe43caf0e3a

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

describe :file_stat, :shared => true do
  before :each do
    @file = tmp('/i_exist')
    File.open(@file,'w'){|f| f.write 'rubinius'}
  end

  after :each do
    File.delete(@file) if File.exist?(@file)
  end

  it "returns a File::Stat object if the given file exists" do
    st = File.send(@method, @file)

    st.file?.should == true
    st.zero?.should == false
    st.size.should == 8
    st.size?.should == 8
    st.blksize.should > 0
    st.atime.class.should == Time
    st.ctime.class.should == Time
    st.mtime.class.should == Time
  end

  it "should be able to use the instance methods" do
    st = File.new(@file).send(@method)

    st.file?.should == true
    st.zero?.should == false
    st.size.should == 8
    st.size?.should == 8
    st.blksize.should > 0
    st.atime.class.should == Time
    st.ctime.class.should == Time
    st.mtime.class.should == Time
  end

  it "raises an Errno::ENOENT if the file does not exist" do
    lambda {
      File.send(@method, "fake_file")
    }.should raise_error(Errno::ENOENT)
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rhodes-2.0.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.rc2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.rc1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta11 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta10 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta9 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta8 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta7 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta6 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-1.5.5 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-2.0.0.beta1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-1.5.4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-1.5.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-1.5.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-1.5.1 spec/framework_spec/app/spec/core/file/shared/stat.rb