Skip to content

Commit

Permalink
test and fix #call example
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Apr 17, 2011
1 parent 97620ef commit 039675f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.de.rdoc
Expand Up @@ -909,7 +909,7 @@ anderen Route gefordert wird. Um das zu erreichen, lässt sich +call+ nutzen:

get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, body.upcase]
[status, headers, body.map(&:upcase)]
end

get '/bar' do
Expand Down
2 changes: 1 addition & 1 deletion README.es.rdoc
Expand Up @@ -884,7 +884,7 @@ servir. Para lograr esto, podés usar +call+:

get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, body.upcase]
[status, headers, body.map(&:upcase)]
end

get '/bar' do
Expand Down
2 changes: 1 addition & 1 deletion README.fr.rdoc
Expand Up @@ -912,7 +912,7 @@ simplement +call+ :

get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, body.upcase]
[status, headers, body.map(&:upcase)]
end

get '/bar' do
Expand Down
2 changes: 1 addition & 1 deletion README.rdoc
Expand Up @@ -864,7 +864,7 @@ of calling another route. Simply use +call+ to achieve this:

get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, body.upcase]
[status, headers, body.map(&:upcase)]
end

get '/bar' do
Expand Down
2 changes: 1 addition & 1 deletion README.ru.rdoc
Expand Up @@ -859,7 +859,7 @@ Thin - это более производительный и функциона

get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, body.upcase]
[status, headers, body.map(&:upcase)]
end

get '/bar' do
Expand Down
2 changes: 1 addition & 1 deletion README.zh.rdoc
Expand Up @@ -844,7 +844,7 @@ Session被用来在请求之间保持状态。如果被激活,每一个用户

get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, body.upcase]
[status, headers, body.map(&:upcase)]
end

get '/bar' do
Expand Down
17 changes: 17 additions & 0 deletions test/routing_test.rb
Expand Up @@ -1043,6 +1043,23 @@ def authorize(username, password)
assert not_found?
end

it 'allows using call to fire another request internally' do
mock_app do
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
[status, headers, body.map(&:upcase)]
end

get '/bar' do
"bar"
end
end

get '/foo'
assert ok?
assert_body "BAR"
end

it 'plays well with other routing middleware' do
middleware = Sinatra.new
inner_app = Sinatra.new { get('/foo') { 'hello' } }
Expand Down

0 comments on commit 039675f

Please sign in to comment.