Sha256: 0aa7babe1c0ffe960bc236084e82634bd842a142358adba19f5da5e92a7536af

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

require 'spidr/extensions/uri'

require 'spec_helper'

describe URI do
  describe "expand_path" do
    it "should preserve single directory paths" do
      URI.expand_path('path').should == 'path'
    end

    it "should preserve trailing '/'" do
      URI.expand_path('test/path/').should == 'test/path/'
    end

    it "should remove multiple '/' characters" do
      URI.expand_path('///test///path///').should == '/test/path/'
    end

    it "should remove '.' directories from the path" do
      URI.expand_path('test/./path').should == 'test/path'
    end

    it "should handle '..' directories properly" do
      URI.expand_path('test/../path').should == 'path'
    end

    it "should limit the number of '..' directories resolved" do
      URI.expand_path('/test/../../../..').should == '/'
    end

    it "should preserve absolute paths" do
      URI.expand_path('/test/path').should == '/test/path'
    end

    it "should preserve the root path" do
      URI.expand_path('/').should == '/'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spidr-0.2.7 spec/extensions/uri_spec.rb
spidr-0.2.6 spec/extensions/uri_spec.rb
spidr-0.2.5 spec/extensions/uri_spec.rb
spidr-0.2.4 spec/extensions/uri_spec.rb
spidr-0.2.3 spec/extensions/uri_spec.rb
spidr-0.2.2 spec/extensions/uri_spec.rb
spidr-0.2.1 spec/extensions/uri_spec.rb
spidr-0.2.0 spec/extensions/uri_spec.rb