Sha256: fe92bc3452065efa8a1dbaf71b947a159913fac4fabc1df69743265e7e397780

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

require_relative '../../test_helper'
require 'rack'
require 'logster/redis_store'
require 'logster/middleware/viewer'

class TestViewer < Minitest::Test

  def teardown
  end

  def viewer
    @viewer ||= begin
                  store = Logster::RedisStore.new
                  Logster::Middleware::Viewer.new(nil, store: store, path: "/logsie")
                end
  end

  def test_path_resolution
    assert_nil(viewer.send(:resolve_path, "/logs"))
    assert_equal("/",viewer.send(:resolve_path, "/logsie"))
    assert_equal("/",viewer.send(:resolve_path, "/logsie/"))
    assert_equal("/hello/world",viewer.send(:resolve_path, "/logsie/hello/world"))
  end

  def test_assets
    env = {}
    env["PATH_INFO"] = "/logsie/javascript/external/jquery.min.js"
    env["REQUEST_METHOD"] = "GET"

    result,  = viewer.call(env)
    assert_equal(200, result)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logster-0.0.2 test/logster/middleware/test_viewer.rb
logster-0.0.1 test/logster/middleware/test_viewer.rb