Sha256: 03f0656c05121ba51a5a81be62b10c8e11b46ca955fe375fe7a94a4d0eaa2392

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'helper'

class TestHttpMethod < Test::Unit::TestCase

  context "ntail" do

    context "(with Sickill::Rainbow enabled)" do

      setup do
        Sickill::Rainbow.enabled = true
      end

      should "color-code the HTTP method" do

        # read-only methods are never color-coded...
        log_line = random_log_line(:http_method => 'GET')
        assert_equal "GET", log_line.to_http_method_s

        # methods that change state are ALWAYS color-coded if Rainbow is enabled...
        log_line = random_log_line(:http_method => 'POST')
        assert_not_equal "POST", log_line.to_http_method_s
        assert_equal "POST".inverse, log_line.to_http_method_s

      end

    end

    context "(with Sickill::Rainbow disabled)" do

      setup do
        Sickill::Rainbow.enabled = false
      end

      should "NOT color-code the HTTP method" do

        # read-only methods are never color-coded...
        log_line = random_log_line(:http_method => 'GET')
        assert_equal "GET", log_line.to_http_method_s

        # methods that change state are NOT color-coded if Rainbow is disabled...
        log_line = random_log_line(:http_method => 'POST')
        assert_equal "POST", log_line.to_http_method_s

      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ntail-1.3.2 test/ntail/test_http_method.rb