Sha256: e02152a3e33f30fafa5d5e451158e31c3f2b596602da171dcd48a4ac57a7f854

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

describe "strip_path_prefix plugin" do 
  it "strips path prefix when expanding paths" do
    app(:bare){}
    abs_dir = app.expand_path('spec')

    app.plugin :strip_path_prefix
    app.expand_path('spec').must_equal 'spec'
    File.expand_path(app.expand_path('spec'), Dir.pwd).must_equal abs_dir

    app.expand_path('/foo').must_equal '/foo'
    app.expand_path('bar', '/foo').must_equal '/foo/bar'

    app.opts[:root] = '/foo'
    app.expand_path('bar').must_equal '/foo/bar'
    app.plugin :strip_path_prefix, '/foo'
    app.expand_path('bar').must_equal 'bar'

    app.opts[:root] = '/foo/bar'
    app.expand_path('baz').must_equal 'bar/baz'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roda-2.29.0 spec/plugin/strip_path_prefix_spec.rb
roda-2.28.0 spec/plugin/strip_path_prefix_spec.rb
roda-2.27.0 spec/plugin/strip_path_prefix_spec.rb
roda-2.26.0 spec/plugin/strip_path_prefix_spec.rb
roda-2.25.0 spec/plugin/strip_path_prefix_spec.rb
roda-2.24.0 spec/plugin/strip_path_prefix_spec.rb