Sha256: a0bda7368f9a8296c9cb90418e38c2e149ca7b193fd47bb21cf00faa88215c10

Contents?: true

Size: 1.65 KB

Versions: 8

Compression:

Stored size: 1.65 KB

Contents

require 'assert'
require 'test/support/fake_app'
require 'deas/logging'

module Deas::Logging

  class BaseTests < Assert::Context
    desc "Deas::Logging"
    setup do
      @app = FakeApp.new
    end
    subject{ Deas::Logging }

    should have_imeths :middleware

  end

  class VerboseLoggingTests < BaseTests
    desc "Deas::VerboseLogging"
    setup do
      @middleware = Deas::VerboseLogging.new(@app)
    end
    subject{ @middleware }

    should have_imeths :call, :call!

    should "be a kind of Deas::BaseLogging middleware" do
      assert_kind_of Deas::BaseLogging, subject
    end

  end

  class SummaryLoggingTests < BaseTests
    desc "Deas::SummaryLogging"
    setup do
      @middleware = Deas::SummaryLogging.new(@app)
    end
    subject{ @middleware }

    should have_imeths :call, :call!

    should "be a kind of Deas::BaseLogging middleware" do
      assert_kind_of Deas::BaseLogging, subject
    end

  end

  class SummaryLineTests < BaseTests
    desc "Deas::SummaryLine"
    subject{ Deas::SummaryLine }

    should "output its attributes in a specific order" do
      assert_equal %w{time status method path handler params}, subject.keys
    end

    should "output its attributes in a single line" do
      line_attrs = {
        'time' => 't',
        'status' => 's',
        'method' => 'm',
        'path' => 'pth',
        'handler' => 'h',
        'params' => 'p',
      }
      exp_line = "time=\"t\" "\
                 "status=\"s\" "\
                 "method=\"m\" "\
                 "path=\"pth\" "\
                 "handler=\"h\" "\
                 "params=\"p\""
      assert_equal exp_line, subject.new(line_attrs)
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
deas-0.13.1 test/unit/logging_tests.rb
deas-0.13.0 test/unit/logging_tests.rb
deas-0.12.0 test/unit/logging_tests.rb
deas-0.11.0 test/unit/logging_tests.rb
deas-0.10.0 test/unit/logging_tests.rb
deas-0.9.0 test/unit/logging_tests.rb
deas-0.8.0 test/unit/logging_tests.rb
deas-0.7.0 test/unit/logging_tests.rb