diff options
author | David Lee <davidomundo@gmail.com> | 2011-05-07 01:19:01 -0700 |
---|---|---|
committer | David Lee <davidomundo@gmail.com> | 2011-05-07 03:04:26 -0700 |
commit | 17a91a6ef93008170e50c073d1c3794f038a0a33 (patch) | |
tree | 46d33bc3274dae6a75aa17c7e3ef1b5cc7ee6f79 /railties/test/application/rack/logger_test.rb | |
parent | fa8623b52ef136d9479fe4f9cc61256228d590e0 (diff) | |
download | rails-17a91a6ef93008170e50c073d1c3794f038a0a33.tar.gz rails-17a91a6ef93008170e50c073d1c3794f038a0a33.tar.bz2 rails-17a91a6ef93008170e50c073d1c3794f038a0a33.zip |
Logs should show overridden method; Issue 426
Diffstat (limited to 'railties/test/application/rack/logger_test.rb')
-rw-r--r-- | railties/test/application/rack/logger_test.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/railties/test/application/rack/logger_test.rb b/railties/test/application/rack/logger_test.rb new file mode 100644 index 0000000000..a29244357c --- /dev/null +++ b/railties/test/application/rack/logger_test.rb @@ -0,0 +1,40 @@ +require "isolation/abstract_unit" +require "active_support/log_subscriber/test_helper" +require "rack/test" + +module ApplicationTests + module RackTests + class LoggerTest < Test::Unit::TestCase + include ActiveSupport::LogSubscriber::TestHelper + include Rack::Test::Methods + + def setup + build_app + require "#{app_path}/config/environment" + super + end + + def logs + @logs ||= @logger.logged(:info) + end + + test "logger logs proper HTTP verb and path" do + get "/blah" + wait + assert_match /^Started GET "\/blah"/, logs[0] + end + + test "logger logs HTTP verb override" do + post "/", {:_method => 'put'} + wait + assert_match /^Started PUT "\/"/, logs[0] + end + + test "logger logs HEAD requests" do + post "/", {:_method => 'head'} + wait + assert_match /^Started HEAD "\/"/, logs[0] + end + end + end +end |