1.2 KiB
1.2 KiB
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 spec
s.
# spec/your-kemal-app-spec.cr
describe "Your::Kemal::App" do
it "renders #index" do
response = HTTP::Client.get "http://localhost:3000/"
response.body.should eq "Hello World!"
end
end
Contributing
- Fork it ( https://github.com/sdogruyol/spec-kemal/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- sdogruyol Sdogruyol - creator, maintainer