forked from zipmark/rspec_api_documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up RspecApiDocumentation
oestrich edited this page May 23, 2012
·
5 revisions
Add RspecApiDocumentation to your Gemfile
gem 'rspec_api_documentation'
Bundle it!
$ bundle
By default RspecApiDocumentation will save generated documents into docs
. The outputted format is HTML. You can edit spec/spec_helper.rb
to change configuration options. The README contains more information about configuration options.
RspecApiDocumentation looks for documentation in spec/acceptance
. It will run anything underneath this directory with the suffix _spec
.
See the example app for how to use the DSL.
The gem contains a Railtie that defines a rake task for generating docs easily with Rails.
$ rake docs:generate
If you are not using Rails, you can use Rake with the following Task:
require 'rspec/core/rake_task'
desc 'Generate API request documentation from API specs'
RSpec::Core::RakeTask.new('docs:generate') do |t|
t.pattern = 'spec/acceptance/**/*_spec.rb'
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"]
end
or
require 'rspec_api_documentation'
load 'tasks/docs.rake'
If you are not using Rake:
$ rspec spec/ --format RspecApiDocumentation::ApiFormatter