Sha256: ae2ab40153bd7a85b59111cf926cecbf8e8f287d741922bf5420ef634be8e41d

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

require_relative "../lib/tynn/matchers"

setup do
  Tynn.plugin(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

2 entries across 2 versions & 1 rubygems

Version Path
tynn-1.2.0 test/matchers_test.rb
tynn-1.1.0 test/matchers_test.rb