Sha256: aef032b9a03247df6e668e29f4d437b4802c073b65faf591cb0268eb308333d5

Contents?: true

Size: 697 Bytes

Versions: 30

Compression:

Stored size: 697 Bytes

Contents

require_relative "../spec_helper"

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

30 entries across 30 versions & 1 rubygems

Version Path
roda-3.9.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.8.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.7.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.6.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.5.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.4.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.3.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.2.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.1.0 spec/plugin/strip_path_prefix_spec.rb
roda-3.0.0 spec/plugin/strip_path_prefix_spec.rb