fork of spec-kemal for https://gitdab.com/luna/kemal
Find a file
Serdar Dogruyol 37925cf90c Merge pull request #6 from drujensen/kemal_as_development_dependency
move kemal to development dependency
2016-11-23 00:26:21 +04:00
spec Don't spawn, build handlers instead 2016-10-26 16:53:36 +03:00
src Upcase method names 2016-10-26 18:00:56 +03:00
.gitignore First commit 2016-04-09 17:37:46 +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
README.md Update README.md 2016-11-05 01:05:09 +02:00
shard.lock Don't spawn, build handlers instead 2016-10-26 16:53:36 +03:00
shard.yml move to development dependency 2016-11-22 12:19:38 -08:00

spec-kemal

Kemal helpers to Crystal's spec for easy testing.

Installation

Add it to your shard.yml.

name: your-kemal-app
version: 0.1.0

dependencies:
  spec-kemal:
    github: sdogruyol/spec-kemal
    branch: master
  kemal:
    github: sdogruyol/kemal
    branch: master

Usage

Just require it before your files in your spec/spec_helper.cr

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

Your Kemal application

# src/your-kemal-app.cr

require "kemal"

get "/" do
  "Hello World!"
end

Kemal.run

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

KEMAL_ENV=test crystal spec
# spec/your-kemal-app-spec.cr

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!"
  end

end

Contributing

  1. Fork it ( https://github.com/sdogruyol/spec-kemal/fork )
  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

Contributors