Sha256: e3a2fa9716bae8194672c4ff22d884fbd661a7c600944cbaa18e1b4d6c55854d

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 Bytes

Contents

require "mireru/logger"
require "stringio"

class LoggerTest < Test::Unit::TestCase
  include MireruTestUtils

  def setup
    @logger = Mireru::Logger.new
  end

  def test_info
    s = ""
    io = StringIO.new(s)
    $stdout = io
    message = <<-EOM
#{Mireru::Command::Mireru::USAGE}
  If no argument, then search current directory.
Keybind:
  n: next
  p: prev
  q: quit
    EOM
    @logger.info(message)
    $stdout = STDOUT
    assert_equal(message, s)
  end

  def test_error
    s = ""
    io = StringIO.new(s)
    $stderr = io
    message = <<-EOM
Warning: valid file not found.
#{Mireru::Command::Mireru::USAGE}
Support file types: png, gif, jpeg(jpg). The others are...yet.
    EOM
    @logger.error(message)
    $stderr = STDERR
    assert_equal(message, s)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mireru-0.2.1 test/test-logger.rb