Permalink
Browse files

test and fix #call example

Conflicts:

	README.ru.rdoc
  • Loading branch information...
1 parent 60dc8d4 commit 84675472014e51812a7068a8be23861543d451c8 @rkh rkh committed Apr 17, 2011
Showing with 22 additions and 5 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.zh.rdoc
  6. +17 −0 test/routing_test.rb
View
@@ -904,7 +904,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
@@ -875,7 +875,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
@@ -895,7 +895,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
@@ -855,7 +855,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
@@ -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
@@ -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 8467547

Please sign in to comment.