Sha256: 1b166b538acf54730d98fd64ee60738a76fbedcc2b99e7f7dfa9b9ee3c32a604

Contents?: true

Size: 1.76 KB

Versions: 31

Compression:

Stored size: 1.76 KB

Contents

require "#{File.dirname(File.join(__rhoGetCurrentDir(), __FILE__))}/../../../spec_helper"
require "#{File.dirname(File.join(__rhoGetCurrentDir(), __FILE__))}/../fixtures/file_types.rb"

describe "File::Stat#ftype" do
  it "returns a String " do
    FileSpecs.normal_file do |file|
      File.lstat(file).ftype.class.should == String
    end
  end

  it "returns 'file' when the file is a file" do
    FileSpecs.normal_file do |file|
      File.lstat(file).ftype.should == 'file'
    end
  end

  it "returns 'directory' when the file is a dir" do
    FileSpecs.directory do |dir|
      File.lstat(dir).ftype.should == 'directory'
    end
  end

  it "returns 'characterSpecial' when the file is a char"  do
    FileSpecs.character_device do |char|
      File.lstat(char).ftype.should == 'characterSpecial'
    end
  end

  platform_is_not :freebsd, :android do  # FreeBSD does not have block devices
    it "returns 'blockSpecial' when the file is a block" do
      FileSpecs.block_device do |block|
        File.lstat(block).ftype.should == 'blockSpecial'
      end
    end
  end

  it "returns 'link' when the file is a link" do
    FileSpecs.symlink do |link|
      File.lstat(link).ftype.should == 'link'
    end
  end

  platform_is_not :android do
    it "returns fifo when the file is a fifo" do
      FileSpecs.fifo do |fifo|
        File.lstat(fifo).ftype.should == 'fifo'
      end
    end
  end

  # This will silently not execute the block if no socket
  # can be found. However, if you are running X, there is
  # a good chance that if nothing else, at least the X
  # Server socket exists.
#  XXX We dont support these sockets
#  it "returns 'socket' when the file is a socket" do
#    FileSpecs.socket do |socket|
#      File.lstat(socket).ftype.should == 'socket'
#    end
#  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

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