1 require File.dirname(__FILE__) + '/helper'
5 def to_result(cx, *args)
7 cx.body "Can't find this shit!"
18 specify "halts when told" do
31 body.should.equal 'fubar'
35 specify "halts with status" do
38 throw :halt, [401, 'get out dude!']
47 status.should.equal 401
48 body.should.equal 'get out dude!'
52 specify "halts with custom result" do
55 throw :halt, CustomResult.new
65 body.should.equal "Can't find this shit!"
71 context "Filter grouping" do
77 specify "befores only run for groups if specified" do
79 Sinatra::EventContext.any_instance.expects(:foo).times(4)
82 foo # this should be called before all events
90 throw :halt, 'not authorized'
93 get '/', :groups => :admins do
104 body.should.equal 'not authorized'
109 body.should.equal 'yeah!'