##// END OF EJS Templates
Link to watched issues list on my page....
Link to watched issues list on my page. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2457 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2376:f70be197e0ae
r2396:5bdd4291624c
Show More
util.rb
53 lines | 1.2 KiB | text/x-ruby | RubyLexer
# Utilities that are only used in the testing code
require 'stringio'
module OpenID
module TestUtil
def assert_log_matches(*regexes)
begin
old_logger = Util.logger
log_output = StringIO.new
Util.logger = Logger.new(log_output)
result = yield
ensure
Util.logger = old_logger
end
log_output.rewind
log_lines = log_output.readlines
assert_equal(regexes.length, log_lines.length,
[regexes, log_lines].inspect)
log_lines.zip(regexes) do |line, regex|
assert_match(regex, line)
end
result
end
def assert_log_line_count(num_lines)
begin
old_logger = Util.logger
log_output = StringIO.new
Util.logger = Logger.new(log_output)
result = yield
ensure
Util.logger = old_logger
end
log_output.rewind
log_lines = log_output.readlines
assert_equal(num_lines, log_lines.length)
result
end
def silence_logging
begin
old_logger = Util.logger
log_output = StringIO.new
Util.logger = Logger.new(log_output)
result = yield
ensure
Util.logger = old_logger
end
result
end
end
end