Sha256: f36c7daada9c3f6eec0001de326ad448f707cfdaad3856800b2b8845b2b57437

Contents?: true

Size: 1.17 KB

Versions: 52

Compression:

Stored size: 1.17 KB

Contents

describe :file_file, :shared => true do
  before :each do
    platform_is :windows do
      @null = "NUL"
      @dir  = "C:\\"
    end

    platform_is_not :windows do
      @null = "/dev/null"
      @dir  = "/bin"
    end

    @file = tmp("test.txt")
    File.open(@file, "w"){} # touch
  end

  after :each do
    File.delete(@file) rescue nil
    @null = nil
    @file = nil
  end

  it "returns true if the named file exists and is a regular file." do
    @object.send(@method, @file).should == true
    @object.send(@method, @dir).should == false
  end

  platform_is_not :windows do
    it "return true if the null device exists and is a regular file." do
      @object.send(@method, @null).should == false # May fail on MS Windows
    end
  end

  it "raises an ArgumentError if not passed one argument" do
    lambda { @object.send(@method)               }.should raise_error(ArgumentError)
    lambda { @object.send(@method, @null, @file) }.should raise_error(ArgumentError)
  end

  it "raises a TypeError if not passed a String type" do
    lambda { @object.send(@method, nil) }.should raise_error(TypeError)
    lambda { @object.send(@method, 1)   }.should raise_error(TypeError)
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
rhodes-2.3.2 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.2.beta.2 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.2.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.1.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.0 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.0.beta.3 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.0.beta.2 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.3.0.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.6 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.6.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.5 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.5.beta.3 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.5.beta.2 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.5.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.4.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.3 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.3.beta.1 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.2 spec/framework_spec/app/spec/shared/file/file.rb
rhodes-2.2.2.beta.1 spec/framework_spec/app/spec/shared/file/file.rb