mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
r3689@sedna: jeremy | 2005-10-16 10:24:36 -0700
Ticket 2404 - delete fixtures after using them r3744@sedna: jeremy | 2005-10-23 12:28:28 -0700 track dirty and loaded fixtures more carefully r3745@sedna: jeremy | 2005-10-23 12:29:39 -0700 fix broken tests r3756@sedna: jeremy | 2005-10-23 15:51:00 -0700 Global Logger.silencer switch for Logger#silence. r3757@sedna: jeremy | 2005-10-23 15:51:35 -0700 Correct changelogs git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2715 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
a2f0ae76d1
commit
b57c86ae74
5 changed files with 29 additions and 7 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
* Abbreviate RAILS_ROOT in traces
|
||||
|
||||
|
||||
*1.10.1* (October 19th, 2005)
|
||||
|
||||
* Update error trace templates [Nicholas Seckar]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
*1.12.1* (October 19th, 2005)
|
||||
*SVN*
|
||||
|
||||
* Keep closer tabs on dirty, loaded, and declared fixtures. #2404 [ryand-ruby@zenspider.com]
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
|||
|
||||
* Make all tests runnable on their own. #2521. [Blair Zajac <blair@orcaware.com>]
|
||||
|
||||
*1.12.1* (October 19th, 2005)
|
||||
|
||||
* Always parenthesize :conditions options so they may be safely combined with STI and constraints.
|
||||
|
||||
* Correct PostgreSQL primary key sequence detection. #2507 [tmornini@infomania.com]
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Set Logger.silencer = false to disable Logger#silence. Useful for debugging fixtures.
|
||||
|
||||
* Add title case method to String to do, e.g., 'action_web_service'.titlecase # => 'Action Web Service'. [Marcel Molina Jr.]
|
||||
|
||||
*1.2.1* (October 19th, 2005)
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
require 'logger'
|
||||
require File.dirname(__FILE__) + '/class_attribute_accessors'
|
||||
|
||||
class Logger #:nodoc:
|
||||
cattr_accessor :silencer
|
||||
self.silencer = true
|
||||
|
||||
# Silences the logger for the duration of the block.
|
||||
def silence(temporary_level = Logger::ERROR)
|
||||
old_logger_level, self.level = level, temporary_level
|
||||
yield self
|
||||
ensure
|
||||
self.level = old_logger_level
|
||||
if silencer
|
||||
begin
|
||||
old_logger_level, self.level = level, temporary_level
|
||||
yield self
|
||||
ensure
|
||||
self.level = old_logger_level
|
||||
end
|
||||
else
|
||||
yield self
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -32,7 +32,14 @@ class CleanLoggerTest < Test::Unit::TestCase
|
|||
logger.fatal 'fatal'
|
||||
end
|
||||
|
||||
assert_equal "error\nfatal\nerror\nfatal\n", @out.string
|
||||
# Silencer off.
|
||||
Logger.silencer = false
|
||||
@logger.silence do |logger|
|
||||
logger.warn 'unsilenced'
|
||||
end
|
||||
Logger.silencer = true
|
||||
|
||||
assert_equal "error\nfatal\nerror\nfatal\nunsilenced\n", @out.string
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue