Sha256: 7c5afa0ec43a7da65053503fa9c02a9f60759f1a643b66d80404754efe032cc5

Contents?: true

Size: 1021 Bytes

Versions: 8

Compression:

Stored size: 1021 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe FSPath do
  it "should inherit from Pathname" do
    FSPath.new('.').should be_kind_of(Pathname)
  end

  it "should use shortcut" do
    FSPath('.').should === FSPath.new('.')
  end

  describe "~" do
    it "should return current user home directory" do
      FSPath.~.should == FSPath(File.expand_path('~'))
    end

    it "should return other user home directory" do
      FSPath.~('root').should == FSPath(File.expand_path('~root'))
    end
  end

  describe "/" do
    it "should join path with string" do
      (FSPath('a') / 'b').should == FSPath('a/b')
    end

    it "should join path with another FSPath" do
      (FSPath('a') / FSPath('b')).should == FSPath('a/b')
    end

    it "should join with path starting with slash" do
      (FSPath('a') / '/b').should == FSPath('a/b')
    end
  end

  describe "+" do
    it "should return instance of FSPath" do
      (FSPath('a') + 'b').should be_instance_of(FSPath)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fspath-0.0.2.5-darwin spec/fspath_spec.rb
fspath-0.0.2.5 spec/fspath_spec.rb
fspath-0.0.2.4 spec/fspath_spec.rb
fspath-0.0.2.4-darwin spec/fspath_spec.rb
fspath-0.0.2.3-darwin spec/fspath_spec.rb
fspath-0.0.2.2-darwin spec/fspath_spec.rb
fspath-0.0.2 spec/fspath_spec.rb
fspath-0.0.2-darwin spec/fspath_spec.rb