Sha256: a2c1c0a467c9a8ee47129a0c377889b76f8718030ffe74469ea1f1ab43f84e71

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

require_relative "helper"
require_relative "../lib/tynn/static"

class StaticTest < Minitest::Test
  def setup
    @app = Class.new(Tynn)
  end

  def test_serve_static_files_ok
    @app.plugin(Tynn::Static, ["/test"], root: Dir.pwd)

    @app.define {}

    ts = Tynn::Test.new(@app)
    ts.get("/test/static_test.rb")

    assert_equal 200, ts.res.status
  end

  def test_serve_static_files_not_found
    @app.plugin(Tynn::Static, ["/test"], root: Dir.pwd)

    @app.define {}

    ts = Tynn::Test.new(@app)
    ts.get("/test/file_not_exists.rb")

    assert_equal 404, ts.res.status
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tynn-2.0.0.alpha test/static_test.rb