Sha256: 4ce8ff79b5c5438a954621abfa3d03bab039c905be68cfac3b2b9b543f114d85

Contents?: true

Size: 1.69 KB

Versions: 83

Compression:

Stored size: 1.69 KB

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../shared/file/symlink'

describe "File.symlink" do
  before :each do
    @file = "test.txt"
    @link = "test.lnk"
    File.delete(@link) if File.exist?(@link)
    File.delete(@file) if File.exist?(@file)
    File.open(@file,"w+")
  end

  after :each do
    File.unlink(@link) if File.exist?(@link)
    File.delete(@file) if File.exist?(@file)
    @link = nil
  end

  platform_is_not :windows do
    it "create a symlink between a source and target file" do
      File.symlink(@file, @link).should == 0
      File.exists?(@link).should == true
      File.identical?(@file, @link).should == true
    end

    it "create a symbolic link" do
      File.symlink(@file, @link)
      File.symlink?(@link).should == true
    end

    it "raises an Errno::EEXIST if the target already exists" do
      File.symlink(@file, @link)
      lambda { File.symlink(@file, @link) }.should raise_error(Errno::EEXIST)
    end

    it "raises an ArgumentError if not called with two arguments" do
      lambda { File.symlink        }.should raise_error(ArgumentError)
      lambda { File.symlink(@file) }.should raise_error(ArgumentError)
    end

    it "raises a TypeError if not called with String types" do
      lambda { File.symlink(@file, nil) }.should raise_error(TypeError)
      lambda { File.symlink(@file, 1)   }.should raise_error(TypeError)
      lambda { File.symlink(1, 1)       }.should raise_error(TypeError)
    end
  end
end

describe "File.symlink?" do
  it_behaves_like :file_symlink, :symlink?, File
  it_behaves_like :file_symlink_nonexistent, :symlink?, File
end

Version data entries

83 entries across 83 versions & 1 rubygems

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