Sha256: ebb067ed03b2c8fde12f1487e58ea01b169d643920e30f25e371a8ef18e198f4

Contents?: true

Size: 635 Bytes

Versions: 8

Compression:

Stored size: 635 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

8 entries across 8 versions & 1 rubygems

Version Path
roda-2.29.0 spec/plugin/pass_spec.rb
roda-2.28.0 spec/plugin/pass_spec.rb
roda-2.27.0 spec/plugin/pass_spec.rb
roda-2.26.0 spec/plugin/pass_spec.rb
roda-2.25.0 spec/plugin/pass_spec.rb
roda-2.24.0 spec/plugin/pass_spec.rb
roda-2.23.0 spec/plugin/pass_spec.rb
roda-2.22.0 spec/plugin/pass_spec.rb