All Projects → kemalcr → spec-kemal

kemalcr / spec-kemal

Licence: MIT license
Easy testing for Kemal

Programming Languages

crystal
512 projects

Projects that are alternatives of or similar to spec-kemal

framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (-29.41%)
Mutual labels:  tdd, spec
Kahlan
✔️ PHP Test Framework for Freedom, Truth, and Justice
Stars: ✭ 1,065 (+1988.24%)
Mutual labels:  tdd, spec
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-49.02%)
Mutual labels:  tdd, spec
Dockerspec
A small Ruby Gem to run RSpec and Serverspec, Infrataster and Capybara tests against Dockerfiles or Docker images easily.
Stars: ✭ 181 (+254.9%)
Mutual labels:  tdd, spec
Kitchen In Travis
Chef cookbook example to run test-kitchen inside Travis CI.
Stars: ✭ 36 (-29.41%)
Mutual labels:  tdd, spec
Inspec
InSpec: Auditing and Testing Framework
Stars: ✭ 2,450 (+4703.92%)
Mutual labels:  tdd, spec
dropbox-api-spec
The Official API Spec for Dropbox API V2 SDKs.
Stars: ✭ 36 (-29.41%)
Mutual labels:  spec
oci-spec-rs
OCI Runtime, Image and Distribution Spec in Rust
Stars: ✭ 117 (+129.41%)
Mutual labels:  spec
spec-pattern
Specification design pattern for JavaScript and TypeScript with bonus classes
Stars: ✭ 43 (-15.69%)
Mutual labels:  spec
chai-exclude
Exclude keys to compare from a deep equal operation with chai expect or assert.
Stars: ✭ 33 (-35.29%)
Mutual labels:  tdd
pydantic-factories
Simple and powerful mock data generation using pydantic or dataclasses
Stars: ✭ 380 (+645.1%)
Mutual labels:  tdd
colorizzar
📗 -> 📘 Change color of png keep alpha channel in php!
Stars: ✭ 27 (-47.06%)
Mutual labels:  tdd
mugshot
Framework independent visual testing library
Stars: ✭ 126 (+147.06%)
Mutual labels:  tdd
memo
다양한 MD 메모
Stars: ✭ 87 (+70.59%)
Mutual labels:  tdd
eye drops
Configurable Elixir mix task to watch file changes and run the corresponding command.
Stars: ✭ 51 (+0%)
Mutual labels:  tdd
finance-project-ddd
Projeto financeiro usando domain driven design, tdd, arquitetura hexagonal e solid
Stars: ✭ 67 (+31.37%)
Mutual labels:  tdd
typeless
Typeless: the benefits of TypeScript, without the types
Stars: ✭ 17 (-66.67%)
Mutual labels:  tdd
svut
SVUT is a simple framework to create Verilog/SystemVerilog unit tests. Just focus on your tests!
Stars: ✭ 48 (-5.88%)
Mutual labels:  tdd
goss
Quick and Easy server testing/validation
Stars: ✭ 26 (-49.02%)
Mutual labels:  tdd
ko-component-tester
🚦 TDD Helpers for Knockout JS
Stars: ✭ 15 (-70.59%)
Mutual labels:  tdd

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: kemalcr/spec-kemal
    branch: master
  kemal:
    github: kemalcr/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

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.

Contributing

  1. Fork it ( https://github.com/kemalcr/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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].