Sha256: 62abc7601122c05a6f1d42338ae8c944a2f086d48818fb900da89a7f3f9fe703

Contents?: true

Size: 1.53 KB

Versions: 24

Compression:

Stored size: 1.53 KB

Contents

require File.expand_path('../../../../../lib/bubble-wrap/requirement/path_manipulation', __FILE__)

describe BubbleWrap::Requirement::PathManipulation do

  before do
    @subject = Object.new
    @subject.extend BubbleWrap::Requirement::PathManipulation
  end

  describe '#convert_caller_to_path' do
    it 'strips off from the second-to-last colon' do
      @subject.convert_caller_to_path("/fake/:path/foo:91:in `fake_method'").
        should == '/fake/:path'
    end

    it 'leaves plain old paths unmolested' do
      @subject.convert_caller_to_path("/fake/path").
        should == '/fake/path'
    end
  end

  describe '#convert_to_absolute_path' do
    it 'converts relative paths to absolute paths' do
      @subject.convert_to_absolute_path('foo')[0].should == '/'
    end

    it "doesn't modify absolute paths" do
      @subject.convert_to_absolute_path('/foo').should == '/foo'
    end
  end

  describe '#strip_up_to_last_lib' do
    it 'strips off from the last lib' do
      @subject.strip_up_to_last_lib('/fake/lib/dir/lib/foo').
        should == '/fake/lib/dir'
    end

    it "strips off only a trailing lib" do
      @subject.strip_up_to_last_lib('/fake/lib/dir/lib').
        should == '/fake/lib/dir'
    end

    it "doesn't modify the path otherwise" do
      @subject.strip_up_to_last_lib('/fake/path').
        should == '/fake/path'
    end
  end

  describe "#convert_to_relative" do
    it 'strips off the root portion' do
      @subject.convert_to_relative('/foo/bar/baz', '/foo').
        should == 'bar/baz'
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
bubble-wrap-1.9.7 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.6 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.5 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.4 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.3 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.2 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.1 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.9.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.8.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.7.1 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.7.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.6.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.6.0.rc1 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.5.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.5.0.rc1 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.4.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.3.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.3.0.osx spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.2.0 spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
bubble-wrap-1.2.0.pre spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb