Sha256: 4e7dbd685449a9f74b5f94ae1821f71cb369e4bdb977226039e67132ede8970d

Contents?: true

Size: 682 Bytes

Versions: 7

Compression:

Stored size: 682 Bytes

Contents

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

describe "path plugin" do 
  it "adds path method for defining named paths" do
    app(:bare) do
      plugin :path
      path :foo, "/foo"
      path :bar do |o|
        "/bar/#{o}"
      end

      route do |r|
        "#{foo_path}#{bar_path('a')}"
      end
    end

    body.should == '/foo/bar/a'
  end

  it "raises if both path and block are given" do
    app.plugin :path
    proc{app.path(:foo, '/foo'){}}.should raise_error(Roda::RodaError)
  end

  it "raises if neither path nor block are given" do
    app.plugin :path
    proc{app.path(:foo)}.should raise_error(Roda::RodaError)
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
roda-1.1.0 spec/plugin/path_spec.rb
roda-cj-1.0.5 spec/plugin/path_spec.rb
roda-cj-1.0.4 spec/plugin/path_spec.rb
roda-cj-1.0.3 spec/plugin/path_spec.rb
roda-cj-1.0.2 spec/plugin/path_spec.rb
roda-cj-1.0.1 spec/plugin/path_spec.rb
roda-cj-1.0.0 spec/plugin/path_spec.rb