throw :halt
[sinatra.git] / test / app_test.rb
blob6586203ea6246cbcd82400fb6ca95e8f883ac168
1 require File.dirname(__FILE__) + '/helper'
3 context "Sinatra" do
4   
5   setup do
6     Sinatra.application = nil
7   end
8   
9   specify "handles events" do
10     get '/:name' do
11       'Hello ' + params[:name]
12     end
13     
14     get_it '/Blake'
15     
16     should.be.ok
17     body.should.equal 'Hello Blake'
18   end
19   
20   specify "follows redirects" do
21     get '/' do
22       redirect '/blake'
23     end
24     
25     get '/blake' do
26       'Mizerany'
27     end
28     
29     get_it '/'
30     should.be.redirection
31     body.should.equal ''
32     
33     follow!
34     should.be.ok
35     body.should.equal 'Mizerany'
36   end
37   
38 end