Sha256: 5e039a97f30c4c18fb1104a35116c15c7de3622b37edb3d23572e27caadadb59

Contents?: true

Size: 636 Bytes

Versions: 20

Compression:

Stored size: 636 Bytes

Contents

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

describe "pass plugin" do 
  it "skips the current block if pass is called" do
    app(:pass) do |r|
      r.root do
        r.pass if env['FOO']
        'root'
      end

      r.on :id do |id|
        r.pass if id == 'foo'
        id
      end

      r.on ":x/:y" do |x, y|
        x + y
      end
    end

    body.must_equal 'root'
    status('FOO'=>true).must_equal 404
    body("/a").must_equal 'a'
    body("/a/b").must_equal 'a'
    body("/foo/a").must_equal 'fooa'
    body("/foo/a/b").must_equal 'fooa'
    status("/foo").must_equal 404
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
roda-2.21.0 spec/plugin/pass_spec.rb
roda-2.20.0 spec/plugin/pass_spec.rb
roda-2.19.0 spec/plugin/pass_spec.rb
roda-2.18.0 spec/plugin/pass_spec.rb
roda-2.17.0 spec/plugin/pass_spec.rb
roda-2.16.0 spec/plugin/pass_spec.rb
roda-2.15.0 spec/plugin/pass_spec.rb
roda-2.14.0 spec/plugin/pass_spec.rb
roda-2.13.0 spec/plugin/pass_spec.rb
roda-2.12.0 spec/plugin/pass_spec.rb
roda-2.11.0 spec/plugin/pass_spec.rb
roda-2.10.0 spec/plugin/pass_spec.rb
roda-2.9.0 spec/plugin/pass_spec.rb
roda-2.8.0 spec/plugin/pass_spec.rb
roda-2.7.0 spec/plugin/pass_spec.rb
roda-2.6.0 spec/plugin/pass_spec.rb
roda-2.5.1 spec/plugin/pass_spec.rb
roda-2.5.0 spec/plugin/pass_spec.rb
roda-2.4.0 spec/plugin/pass_spec.rb
roda-2.3.0 spec/plugin/pass_spec.rb