Sha256: 020b9ff90f3a1ce721e773b9d48e5222968906f80e7f626163ec6be1f31e35a1

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 Bytes

Contents

require_relative "../lib/tynn/matchers"

setup do
  Tynn.helpers(Tynn::Matchers)

  Tynn::Test.new
end

test "default" do |app|
  Tynn.define do
    default do
      res.write("foo")
    end
  end

  app.get("/")

  assert_equal 200, app.res.status
  assert_equal "foo", app.res.body
end

test "param?" do |app|
  Tynn.define do
    on param?(:key) do
      res.write(req[:key])
    end
  end

  app.get("/")

  assert_equal 404, app.res.status

  app.get("/", key: "foo")

  assert_equal 200, app.res.status
  assert_equal "foo", app.res.body
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tynn-0.0.4 test/matchers_test.rb
tynn-0.0.3 test/matchers_test.rb