Permalink
Browse files

test and fix #call example

  • Loading branch information...
1 parent 97620ef commit 039675f4b41176f56bcd167715714c95f338b050 @rkh rkh committed Apr 17, 2011
Showing with 23 additions and 6 deletions.
  1. +1 −1 README.de.rdoc
  2. +1 −1 README.es.rdoc
  3. +1 −1 README.fr.rdoc
  4. +1 −1 README.rdoc
  5. +1 −1 README.ru.rdoc
  6. +1 −1 README.zh.rdoc
  7. +17 −0 test/routing_test.rb
View
2 README.de.rdoc
@@ -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
View
2 README.es.rdoc
@@ -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
View
2 README.fr.rdoc
@@ -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
View
2 README.rdoc
@@ -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
View
2 README.ru.rdoc
@@ -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
View
2 README.zh.rdoc
@@ -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
View
17 test/routing_test.rb
@@ -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' } }

0 comments on commit 039675f

Please sign in to comment.