Sha256: 02f9a75e4506395e2d58a0d704fd21908d55e9b7a7a74b88df6be48507558573

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

require "minitest/autorun"
require "mocha/setup"
require_relative "../lib/mini_graphite"

class MiniGraphiteTest < MiniTest::Unit::TestCase

  def test_debug
    Kernel.expects(:puts).with(regexp_matches(/MESSAGE/))
    logger = Dalia::MiniGraphite::Logger.new
    logger.debug("MESSAGE")
  end

  def test_debug_when_not_debug_mode
    Kernel.expects(:puts).never
    logger = Dalia::MiniGraphite::Logger.new(false)
    logger.debug("MESSAGE")
  end

  def test_debug_when_rails_actived
    Kernel.const_set("Rails", mock(:logger => mock(:info)))
    logger = Dalia::MiniGraphite::Logger.new
    logger.debug("MESSAGE")
    Kernel.send(:remove_const, :Rails)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mini_graphite-0.2.1 test/logger_test.rb
mini_graphite-0.0.5 test/logger_test.rb