aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-08-31 16:29:21 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-08-31 16:29:21 +0100
commit56c2b02f592aa7c127346f2c68ac45236c27702e (patch)
treea9eadea109c36c29be817e906f8808b1f61356d7 /actionpack/test
parentcdda7defa0a37ff776ca961c8eeae347a46dd59b (diff)
downloadrails-56c2b02f592aa7c127346f2c68ac45236c27702e.tar.gz
rails-56c2b02f592aa7c127346f2c68ac45236c27702e.tar.bz2
rails-56c2b02f592aa7c127346f2c68ac45236c27702e.zip
Fix AM tests and add tests for rendering logging
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/render_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 8d15aa2da4..c4a2bf3db3 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -8,6 +8,18 @@ module Fun
end
end
+class MockLogger
+ attr_reader :logged
+
+ def initialize
+ @logged = []
+ end
+
+ def method_missing(method, *args)
+ @logged << args.first
+ end
+end
+
class TestController < ActionController::Base
class LabellingFormBuilder < ActionView::Helpers::FormBuilder
end
@@ -1385,3 +1397,21 @@ class LastModifiedRenderTest < Test::Unit::TestCase
assert_equal @last_modified, @response.headers['Last-Modified']
end
end
+
+class RenderingLoggingTest < Test::Unit::TestCase
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @controller = TestController.new
+
+ @request.host = "www.nextangle.com"
+ end
+
+ def test_logger_prints_layout_and_template_rendering_info
+ @controller.logger = MockLogger.new
+ get :layout_test
+ logged = @controller.logger.logged.find_all {|l| l =~ /render/i }
+ assert_equal "Rendering template within layouts/standard", logged[0]
+ assert_equal "Rendering test/hello_world", logged[1]
+ end
+end