Sha256: cf651aa74e4c82fd6784ac3851a5aab58a7e7988af99aa79fecf4440016566dc

Contents?: true

Size: 1.36 KB

Versions: 33

Compression:

Stored size: 1.36 KB

Contents

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

  after :each do
    rm_r @file
  end

  # TODO: Fix
  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
if ( System.get_property('platform') != 'WINDOWS' )    
    st.blksize.should > 0
end    
    st.atime.should be_kind_of(Time)
    st.ctime.should be_kind_of(Time)
    st.mtime.should be_kind_of(Time)
  end

  # TODO: Fix
  it "returns a File::Stat objecw when called on an instance of File" do
    File.open(@file) do |f|
      st = f.send(@method)

      st.file?.should == true
      st.zero?.should == false
      st.size.should == 8
      st.size?.should == 8
if ( System.get_property('platform') != 'WINDOWS' )      
      st.blksize.should > 0
end      
      st.atime.should be_kind_of(Time)
      st.ctime.should be_kind_of(Time)
      st.mtime.should be_kind_of(Time)
    end
  end

  ruby_version_is "1.9" do
    it "accepts an object that has a #to_path method" do
      File.send(@method, mock_to_path(@file))
    end
  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

33 entries across 33 versions & 1 rubygems

Version Path
rhodes-3.3.5 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.3.beta.4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.3.beta.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.3.beta.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.3.beta.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.7 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.6 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.5 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.4 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.2.beta.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.1 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.0 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.0.beta.3 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.0.beta.2 spec/framework_spec/app/spec/core/file/shared/stat.rb
rhodes-3.3.0.beta.1 spec/framework_spec/app/spec/core/file/shared/stat.rb