Sha256: 580ee6daa45b3a2d8101591bb6b2fb342c39eef85240a9e3ca1e85a88efb5f1a

Contents?: true

Size: 1.12 KB

Versions: 59

Compression:

Stored size: 1.12 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 unless System.get_property('platform') == 'WINDOWS'
    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 unless System.get_property('platform') == 'WINDOWS'
    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

59 entries across 59 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.0 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.0 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/core/file/shared/stat.rb