public
Fork of bmizerany/sinatra
Description: Classy web-development dressed in a DSL
Homepage: http://sinatrarb.com
Clone URL: git://github.com/JackDanger/sinatra.git
Blake Mizerany (author)
Tue Apr 01 18:20:52 -0700 2008
sinatra / test / diddy_test.rb
100644 42 lines (28 sloc) 0.695 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require File.dirname(__FILE__) + '/helper'
 
context "Diddy" do
 
  setup do
    Sinatra.application = nil
  end
 
  specify "should map urls to different apps" do
 
    get '/' do
      'asdf'
    end
    
    get_it '/'
    assert ok?
    assert_equal('asdf', body)
    
    get '/foo', :host => 'foo.sinatrarb.com' do
      'in foo!'
    end
 
    get '/foo', :host => 'bar.sinatrarb.com' do
      'in bar!'
    end
    
    get_it '/foo', {}, 'HTTP_HOST' => 'foo.sinatrarb.com'
    assert ok?
    assert_equal 'in foo!', body
 
    get_it '/foo', {}, 'HTTP_HOST' => 'bar.sinatrarb.com'
    assert ok?
    assert_equal 'in bar!', body
    
    get_it '/foo'
    assert not_found?
    
  end
 
end