fork of spec-kemal for
Go to file
Luna 8042202628 Merge remote-tracking branch 'upstream/master' 2021-10-09 17:34:58 -03:00
spec update kemal version 2017-09-24 17:24:41 +03:00
src Bump to 1.0.0 2021-04-25 16:49:44 +03:00
.gitignore Follow crystal 1.0.0 (#20) 2021-03-26 15:34:36 +03:00
.travis.yml First commit 2016-04-09 17:37:46 +03:00
LICENSE First commit 2016-04-09 17:37:46 +03:00 added section about Kemal.config.always_rescue (#22) 2021-10-04 09:28:13 +03:00
shard.yml Merge remote-tracking branch 'upstream/master' 2021-05-12 11:58:20 -03:00


Kemal helpers to Crystal's spec for easy testing.


Add it to your shard.yml.

name: your-kemal-app
version: 0.1.0

    github: kemalcr/spec-kemal
    branch: master
    github: kemalcr/kemal
    branch: master


Just require it before your files in your spec/

require "spec-kemal"
require "../src/your-kemal-app"

Your Kemal application

# src/

require "kemal"

get "/" do
  "Hello World!"

Now you can easily test your Kemal application in your specs.

KEMAL_ENV=test crystal spec
# spec/

describe "Your::Kemal::App" do

  # You can use get,post,put,patch,delete to call the corresponding route.
  it "renders /" do
    get "/"
    response.body.should eq "Hello World!"


Rescue errors

Errors gets rescued by default which results in the Kemal's exception page is rendered.
This may not always be the desired behaviour, e.g. when a JSON parsing error occurs one might expect "[]" and not Kemal's exception page.

Set Kemal.config.always_rescue = false to prevent this behaviour and raise errors instead.


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request