Logo: Relish

  1. Sign in

Project: Rspec-api-documentation

Rspec-api-documentation

Travis status Gemnasium status

http://github.com/zipmark/rspec_api_documentation

RSpec API Doc Generator

Generate pretty API docs for your Rails APIs.

Installation

Add rspec_api_documentation to your Gemfile

gem 'rspec_api_documentation'

Bundle it!

$> bundle install

Require it in your API tests

require "rspec_api_documentation"
require "rspec_api_documentation/dsl"

See the wiki for additional setup. Setting up RSpec API Documentation

Usage

resource "Account" do
  get "/accounts" do
    example "Get a list of all accounts" do
      do_request
      last_response.status.should be_ok
    end
  end

  get "/accounts/:id" do
    parameter :id, "Account ID"

    let(:account) { Factory(:account) }
    let(:id) { account.id }

    example "Get an account", :document => :public do
      do_request
      last_response.status.should be_ok
    end
  end
end

Topics

  1. Document callbacks
  2. Example Request
  3. Generate HTML documentation from test examples
  4. Use OAuth2 MAC client as a test client

Last published over 3 years ago by samwgoldman.