Sha256: 1e37cb83663032d3b4968871e81e27551f0d7c75c3e7cad47bf4a6981c994938

Contents?: true

Size: 576 Bytes

Versions: 4

Compression:

Stored size: 576 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
    param(:foo) do |foo|
      res.write(foo)
    end

    param("bar") do |bar|
      res.write(bar)
    end
  end

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

  assert_equal "foo", app.res.body

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

  assert_equal "bar", app.res.body
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tynn-1.0.0 test/matchers_test.rb
tynn-1.0.0.rc3 test/matchers_test.rb
tynn-1.0.0.rc2 test/matchers_test.rb
tynn-1.0.0.rc1 test/matchers_test.rb