File: spec_helper.rb

package info (click to toggle)
ruby-logger-application 0.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 188 kB
  • sloc: ruby: 284; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'logger/application'
#require 'mspec/matchers/output_to_fd'
require 'tempfile'
require 'fileutils'

include FileUtils

def tmp(path)
  Tempfile.create(path)
end

module LoggerSpecs

  def self.strip_date(str)
    str.gsub(/[A-Z].*\[.*\]/, "").lstrip
  end

  class TestApp < Logger::Application
    def initialize(appname, log_file=nil)
      super(appname)
      self.set_log(log_file) if log_file
    end

    def run
      log(WARN, "Test log message")
    end
  end
end