wax-spec

Version, currently main branch1 version
  • main branchlatestApr 7, 2026

github.com/jgaskins/wax-spec

Spec helpers for the `wax` shard

2 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  wax-spec:
    github: jgaskins/wax-spec
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 1.12.1
License
MIT
Author
Jamie Gaskins

Dependencies

Runtime Dependencies

README

Wax::Spec

Adds spec helpers for apps using the wax shard. This was pulled out to a separate shard so that apps wouldn't have spec-only dependencies in their production apps.

Installation

  1. Add the dependency to your shard.yml:

    development_dependencies:
      wax-spec:
        github: jgaskins/wax-spec
  2. Run shards install

Usage

In your application's spec helpers, load the appropriate helpers provided by wax-spec. For example, in your applications' spec/routes/route_helper.cr, you would do this:

require "../spec_helper" # your app-wide baseline spec helper file
require "wax-spec/route_helper"

Then in your specs you can do this:

describe RouteUnderTest do
  app = app(RouteUnderTest.new)

  context "GET /" do
    it "returns 200 OK" do
      response = app.get "/"

      response.should have_status :ok
      response.should have_html "Hello"
    end
  end

  context "POST /" do
    it "returns 201 CREATED with the correct params" do
      response = app.post "/", form: {
        # other params ...
        _authenticity_token: app.authenticity_token,
      }

      response.should have_status :created
    end

    it "returns 400 BAD REQUEST without the authenticity token" do
      response = app.post "/", form: {
        # non-authenticity-token params
      }

      response.should have_status :bad_request
    end
  end
end

Contributing

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