Sha256: 56b7ea7495ef86404b1b92e843d80dc556e004d22e5176c8f91fd31a817c1d51

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require File.join(File.dirname(__FILE__), "test_helper.rb")

class LevelTest < Scope::TestCase
  context "without termite ecology" do
    setup do
      @logger = Termite::Logger.new(:level => "error")
    end

    should "correctly set level to error" do
      assert_equal Logger::ERROR, @logger.level
    end
  end

  context "with termite ecology" do
    setup do
      Ecology.reset

      set_up_ecology <<ECOLOGY_TEXT
{
  "application": "foo_app",
  "logging":
    {
      "default_component": "whatcomponent",
      "level": "info"
    }
}
ECOLOGY_TEXT
    end

    context "and no overrides" do
      setup do
        @logger = Termite::Logger.new
      end

      should "correctly have level set at info" do
        assert_equal Logger::INFO, @logger.level
      end
    end

    context "and debug overriding at env level" do
      setup do
        ENV["TERMITE_DEBUG"] = "1"
        @logger = Termite::Logger.new()
      end

      should "correctly have level set at debug" do
        assert_equal Logger::DEBUG, @logger.level
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
termite-0.0.20 test/level_test.rb