spec-kemal/README.md

57 lines
1.1 KiB
Markdown
Raw Normal View History

2016-04-09 14:37:46 +00:00
# spec-kemal
2016-04-09 14:49:51 +00:00
Kemal helpers to Crystal's `spec` for easy testing.
2016-04-09 14:37:46 +00:00
## Installation
2016-04-09 14:49:51 +00:00
Add it to your `shard.yml`.
2016-04-09 14:37:46 +00:00
2016-04-09 14:49:51 +00:00
```yaml
name: your-kemal-app
version: 0.1.0
2016-04-09 14:37:46 +00:00
2016-04-09 14:49:51 +00:00
dependencies:
spec-kemal:
github: sdogruyol/spec-kemal
branch: master
kemal:
github: sdogruyol/kemal
branch: master
```
2016-04-09 14:37:46 +00:00
## Usage
2016-04-09 14:49:51 +00:00
Just require it before your files in your `spec/spec_helper.cr`
2016-04-09 14:37:46 +00:00
2016-04-09 14:49:51 +00:00
```crystal
require "spec-kemal"
require "../src/your-kemal-app"
```
2016-04-09 14:37:46 +00:00
2016-04-09 14:49:51 +00:00
Now you can access your `Kemal` application in your `spec`s.
2016-04-09 14:37:46 +00:00
2016-04-09 14:49:51 +00:00
```crystal
# spec/your-kemal-app-spec.cr
2016-04-09 14:37:46 +00:00
2016-04-09 14:49:51 +00:00
describe "Your::Kemal::App" do
it "renders #index" do
response = HTTP::Client.get "http://localhost:3000/"
response.body.should eq "Hello World!"
end
end
```
2016-04-09 14:37:46 +00:00
## Contributing
2016-04-09 14:49:51 +00:00
1. Fork it ( https://github.com/sdogruyol/spec-kemal/fork )
2016-04-09 14:37:46 +00:00
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
2016-04-09 14:49:51 +00:00
- [sdogruyol](https://github.com/sdogruyol) Sdogruyol - creator, maintainer