Sha256: e5c1662ae7a6a4dd72a1b6b546fcba45094a85bac9029f602d8dfbdff6f33a20

Contents?: true

Size: 678 Bytes

Versions: 90

Compression:

Stored size: 678 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

context "before filters" do

  setup do
    Sinatra.application = nil
    @app = Sinatra.application
  end

  specify "should be executed in the order defined" do
    invoked = 0x0
    @app.before { invoked = 0x01 }
    @app.before { invoked |= 0x02 }
    @app.get('/') { 'Hello World' }
    get_it '/'
    should.be.ok
    body.should.be == 'Hello World'
    invoked.should.be == 0x03
  end

  specify "should be capable of modifying the request" do
    @app.get('/foo') { 'foo' }
    @app.get('/bar') { 'bar' }
    @app.before { request.path_info = '/bar' }
    get_it '/foo'
    should.be.ok
    body.should.be == 'bar'
  end

end

Version data entries

90 entries across 90 versions & 14 rubygems

Version Path
nbudin-castronaut-0.7.5 vendor/sinatra/compat/filter_test.rb
sinatra-0.9.6 compat/filter_test.rb
sinatra-0.9.5 compat/filter_test.rb
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/sinatra-0.9.4/compat/filter_test.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/filter_test.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.10.17 vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.10.16 vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.10.15 vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
middleman-0.10.14 vendor/gems/gems/sinatra-0.9.4/compat/filter_test.rb
sinatra-0.9.4 compat/filter_test.rb
sinatra-0.9.0.3 compat/filter_test.rb
sinatra-0.9.0.4 compat/filter_test.rb
sinatra-0.9.0 compat/filter_test.rb