diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-17 12:46:51 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-17 12:46:51 +1100 |
commit | 6f663addaa7ed40f1133687d7a2be0958bf0c059 (patch) | |
tree | 7beb7f092c1979d1fd5ea6e7aaaf4f59c2f4abf4 /actionpack/test/controller/logging_test.rb | |
parent | 8834b2612b7ddda70ee6a685eb0063d3daa8e63d (diff) | |
parent | 3e94032227d450d479f511070c51f37f53d0ecc4 (diff) | |
download | rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.tar.gz rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.tar.bz2 rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack/test/controller/logging_test.rb')
-rw-r--r-- | actionpack/test/controller/logging_test.rb | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/actionpack/test/controller/logging_test.rb b/actionpack/test/controller/logging_test.rb deleted file mode 100644 index 4206dffa7e..0000000000 --- a/actionpack/test/controller/logging_test.rb +++ /dev/null @@ -1,80 +0,0 @@ -require 'abstract_unit' - -module Another - class LoggingController < ActionController::Base - layout "layouts/standard" - - def show - render :nothing => true - end - - def with_layout - render :template => "test/hello_world", :layout => true - end - end -end - -class LoggingTest < ActionController::TestCase - tests Another::LoggingController - - def setup - super - set_logger - end - - def get(*args) - super - wait - end - - def wait - ActiveSupport::Notifications.notifier.wait - end - - def test_logging_without_parameters - get :show - assert_equal 4, logs.size - assert_nil logs.detect {|l| l =~ /Parameters/ } - end - - def test_logging_with_parameters - get :show, :id => '10' - assert_equal 5, logs.size - - params = logs.detect {|l| l =~ /Parameters/ } - assert_equal 'Parameters: {"id"=>"10"}', params - end - - def test_log_controller_with_namespace_and_action - get :show - assert_match /Processed\sAnother::LoggingController#show/, logs[1] - end - - def test_log_view_runtime - get :show - assert_match /View runtime/, logs[2] - end - - def test_log_completed_status_and_request_uri - get :show - last = logs.last - assert_match /Completed/, last - assert_match /200/, last - assert_match /another\/logging\/show/, last - end - - def test_logger_prints_layout_and_template_rendering_info - get :with_layout - logged = logs.find {|l| l =~ /render/i } - assert_match /Rendered (.*)test\/hello_world.erb within (.*)layouts\/standard.html.erb/, logged - end - - private - def set_logger - @controller.logger = MockLogger.new - end - - def logs - @logs ||= @controller.logger.logged.compact.map {|l| l.to_s.strip} - end -end |