Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Sinatra runtime and testing helpers, extensions, and macros used commonly by Thumble Monks

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 chicago.gemspec
README.markdown

Chicago

It's my kind of town!
- Sinatra

Yeah, we're real clever. We're also from "The city in mid-west best city in the whole wide wide world" ... which makes us double the clever.

Chicago is a collection of runtime and test extensions and helpers that makes some common tasks a little bit easier.

Installation

First, make sure GemCutter is added to your list of sources. If not, install it like so or just follow the instructions for installing the gemcutter gem:

sudo gem sources -a http://gemcutter.org

Then, installing chicago is a quick gem install:

sudo gem install chicago

Usage

Sinatra runtime app

In your Sinatra app, do this:

require 'chicago'

And you'll get some helpful Sinatra extensions and helpers.

If you're Sinatra app is considered modular - as in, you are not using the Sinatra::Default app - you will want to add the following in your app:

YourApp < Sinatra::Base
  register Sinatra::Chicago            # for some DSL helpers
  helpers Sinatra::Chicago::Helpers    # for standard helpers
  helpers Sinatra::Chicago::Responders # for JSON assistance
end

You don't necessarily need all of them. You just need to "include" the statements that mix-in the functionality you want.

Sinatra testing

Assuming you have required 'rack/test', like so:

require 'rack/test'

This is because these macros use last_request defined by the Rack/Test library. If you're using Riot in your tests of your Sinatra app, do this:

require 'chicago/riot'

... and you'll get a bunch of cool Protest macros for testing specific Sinatra stuff.

If you're using Shoulda in your tests of your Sinatra app, do this:

require 'chicago/shoulda'

... and you'll get a bunch of cool Shoulda macros for testing specific Sinatra stuff.

Something went wrong with that request. Please try again.