Sha256: 8acc54cf4134baaaedd99a737250f4c939740455b300aa87f27cc0d2f7108da6

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

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

describe "match_affix plugin" do 
  it "allows changing the match prefix/suffix" do
    app(:bare) do
      plugin :match_affix, "", /(\/|\z)/

      route do |r|
        r.on "/albums" do |b|
          r.on "b/:id" do |id, s|
            "b-#{b}-#{id}-#{s.inspect}"
          end

          "albums-#{b}"
        end
      end
    end

    body("/albums/a/1").should == 'albums-/'
    body("/albums/b/1").should == 'b-/-1-""'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roda-2.2.0 spec/plugin/match_affix_spec.rb
roda-2.1.0 spec/plugin/match_affix_spec.rb
roda-2.0.0 spec/plugin/match_affix_spec.rb
roda-1.3.0 spec/plugin/match_affix_spec.rb
roda-1.2.0 spec/plugin/match_affix_spec.rb