Skip to content

Instantly share code, notes, and snippets.

@jonah-williams
jonah-williams / api_docs.rake
Created April 21, 2011 16:19
Instrumenting rspec and using a custom formatter to generate API docs from specs. See http://blog.carbonfive.com/2011/04/21/generating-documentation-from-specs/
require 'rubygems'
require 'rspec/core/rake_task'
namespace :project_name do
namespace :api do
desc 'Generate API request documentation from API specs'
RSpec::Core::RakeTask.new('generate_docs') do |t|
t.pattern = 'spec/controllers/api/**/*_spec.rb'
t.rspec_opts = ["-Ilib/tasks/api_docs", "-rinstrument_specs", "-rapi_formatter", "--format APIFormatter"]
end