Sha256: aa6b89f48956371586db192e82f49c9a3bcc9a4848f93c1aab155e45bcc2b3ef

Contents?: true

Size: 591 Bytes

Versions: 30

Compression:

Stored size: 591 Bytes

Contents

require_relative "../spec_helper"

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

30 entries across 30 versions & 1 rubygems

Version Path
roda-3.28.0 spec/plugin/pass_spec.rb
roda-3.27.0 spec/plugin/pass_spec.rb
roda-3.26.0 spec/plugin/pass_spec.rb
roda-3.25.0 spec/plugin/pass_spec.rb
roda-3.24.0 spec/plugin/pass_spec.rb
roda-3.23.0 spec/plugin/pass_spec.rb
roda-3.22.0 spec/plugin/pass_spec.rb
roda-3.21.0 spec/plugin/pass_spec.rb
roda-3.20.0 spec/plugin/pass_spec.rb
roda-3.19.0 spec/plugin/pass_spec.rb
roda-3.18.0 spec/plugin/pass_spec.rb
roda-3.17.0 spec/plugin/pass_spec.rb
roda-3.16.0 spec/plugin/pass_spec.rb
roda-3.15.0 spec/plugin/pass_spec.rb
roda-3.14.1 spec/plugin/pass_spec.rb
roda-3.14.0 spec/plugin/pass_spec.rb
roda-3.13.0 spec/plugin/pass_spec.rb
roda-3.12.0 spec/plugin/pass_spec.rb
roda-3.11.0 spec/plugin/pass_spec.rb
roda-3.10.0 spec/plugin/pass_spec.rb