Sha256: 6f189803627238ab5e09081962ca753e5084bb13f80117a01cd58bb85ab7f040

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'helper'

class TestHttpVersion < Test::Unit::TestCase

  context "ntail" do

    should "correctly identify the HTTP version of the request" do
      http_version = "HTTP/1.0"
      # directly via the helper function
      assert_equal http_version, NginxTail::LogLine.to_http_version_s(http_version)
      # parsed from a raw log line
      log_line = random_log_line(:http_version => http_version)
      assert_equal http_version, log_line.to_http_version_s
    end

    should "correctly identify the major HTTP version" do
      http_version = "HTTP/1.0"
      # directly via the helper function
      assert_equal "1", NginxTail::LogLine.to_http_version_s(http_version, :major)
      # parsed from a raw log line
      log_line = random_log_line(:http_version => http_version)
      assert_equal "1", log_line.to_http_version_s(:major)
    end

    should "correctly identify the minor HTTP version" do
      http_version = "HTTP/1.0"
      # directly via the helper function
      assert_equal "1", NginxTail::LogLine.to_http_version_s(http_version, :minor)
      # parsed from a raw log line
      log_line = random_log_line(:http_version => http_version)
      assert_equal "1", log_line.to_http_version_s(:minor)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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