Skip to content

Commit

Permalink
rack bodies should be a list
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Dec 22, 2011
1 parent de6e92f commit 3f92e5e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions actionpack/test/controller/routing_test.rb
Expand Up @@ -90,16 +90,16 @@ def get(uri_or_host, path = nil, port = nil)
'REQUEST_METHOD' => 'GET', 'REQUEST_METHOD' => 'GET',
'HTTP_HOST' => host} 'HTTP_HOST' => host}


@rs.call(params)[2] @rs.call(params)[2].join
end end


def test_regexp_precidence def test_regexp_precidence
@rs.draw do @rs.draw do
match '/whois/:domain', :constraints => { match '/whois/:domain', :constraints => {
:domain => /\w+\.[\w\.]+/ }, :domain => /\w+\.[\w\.]+/ },
:to => lambda { |env| [200, {}, 'regexp'] } :to => lambda { |env| [200, {}, %w{regexp}] }


match '/whois/:id', :to => lambda { |env| [200, {}, 'id'] } match '/whois/:id', :to => lambda { |env| [200, {}, %w{id}] }
end end


assert_equal 'regexp', get(URI('http://example.org/whois/example.org')) assert_equal 'regexp', get(URI('http://example.org/whois/example.org'))
Expand All @@ -115,9 +115,9 @@ def matches? request


@rs.draw do @rs.draw do
match '/', :constraints => subdomain.new, match '/', :constraints => subdomain.new,
:to => lambda { |env| [200, {}, 'default'] } :to => lambda { |env| [200, {}, %w{default}] }
match '/', :constraints => { :subdomain => 'clients' }, match '/', :constraints => { :subdomain => 'clients' },
:to => lambda { |env| [200, {}, 'clients'] } :to => lambda { |env| [200, {}, %w{clients}] }
end end


assert_equal 'default', get(URI('http://www.example.org/')) assert_equal 'default', get(URI('http://www.example.org/'))
Expand All @@ -128,11 +128,11 @@ def test_lambda_constraints
@rs.draw do @rs.draw do
match '/', :constraints => lambda { |req| match '/', :constraints => lambda { |req|
req.subdomain.present? and req.subdomain != "clients" }, req.subdomain.present? and req.subdomain != "clients" },
:to => lambda { |env| [200, {}, 'default'] } :to => lambda { |env| [200, {}, %w{default}] }


match '/', :constraints => lambda { |req| match '/', :constraints => lambda { |req|
req.subdomain.present? && req.subdomain == "clients" }, req.subdomain.present? && req.subdomain == "clients" },
:to => lambda { |env| [200, {}, 'clients'] } :to => lambda { |env| [200, {}, %w{clients}] }
end end


assert_equal 'default', get(URI('http://www.example.org/')) assert_equal 'default', get(URI('http://www.example.org/'))
Expand Down

0 comments on commit 3f92e5e

Please sign in to comment.