All Projects → r7kamura → Autodoc

r7kamura / Autodoc

Licence: mit
Generate documentation from your rack application & request-spec.

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Autodoc

ruby3-rails6-bootstrap-heroku
An opinionated starter application based on Ruby 3.0, Rails 6.1, Webpack 5, Yarn, and Bootstrap 5, deployable on Heroku
Stars: ✭ 21 (-94.26%)
Mutual labels:  rspec
spree-postal-service
Weight based calculator for Spree Commerce.
Stars: ✭ 21 (-94.26%)
Mutual labels:  rspec
Everydayrails Rspec 2017
Sample source for the 2017 edition of Everyday Rails Testing with RSpec.
Stars: ✭ 280 (-23.5%)
Mutual labels:  rspec
cppspec
BDD testing for C++ à la RSpec
Stars: ✭ 13 (-96.45%)
Mutual labels:  rspec
massa
Keep the quality, good practices and security of Rails projects.
Stars: ✭ 61 (-83.33%)
Mutual labels:  rspec
jsonapi-swagger
Create a JSONAPI Swagger.
Stars: ✭ 49 (-86.61%)
Mutual labels:  rspec
LocalSupport
A directory of local support services and volunteer opportunities
Stars: ✭ 60 (-83.61%)
Mutual labels:  rspec
Rspec Style Guide
可読性の高いテストコードを書くためのお作法集
Stars: ✭ 325 (-11.2%)
Mutual labels:  rspec
rspec-storage
RSpec output test report to any stroage (current support is [s3, gcs])
Stars: ✭ 22 (-93.99%)
Mutual labels:  rspec
Crystalball
Regression Test Selection library for your RSpec test suite
Stars: ✭ 259 (-29.23%)
Mutual labels:  rspec
limestone-accounts
Boilerplate Rails 5.2 multitenant SaaS application with webpack and Docker integration. Billing is scoped to accounts.
Stars: ✭ 97 (-73.5%)
Mutual labels:  rspec
raddocs
Rspec Api Documentation Browser
Stars: ✭ 72 (-80.33%)
Mutual labels:  rspec
rubybookshelf
The Thoughtbot contest Winner application
Stars: ✭ 14 (-96.17%)
Mutual labels:  rspec
yo-ruby
🌈 ✨ A super awesome Ruby wrapper of the Yo API.
Stars: ✭ 15 (-95.9%)
Mutual labels:  rspec
Shoulda Matchers
Simple one-liner tests for common Rails functionality
Stars: ✭ 3,166 (+765.03%)
Mutual labels:  rspec
pytest-it
Decorate your pytest suite with RSpec-style pytest markers, then run `pytest --it` to see a plaintext spec of the test structure.
Stars: ✭ 26 (-92.9%)
Mutual labels:  rspec
factory bot-preload
Preload factories (factory_bot) just like fixtures. It will be easy and, probably, faster!
Stars: ✭ 68 (-81.42%)
Mutual labels:  rspec
N plus one control
RSpec and Minitest matchers to prevent N+1 queries problem
Stars: ✭ 345 (-5.74%)
Mutual labels:  rspec
Infrataster
Infrastructure Behavior Testing Framework
Stars: ✭ 322 (-12.02%)
Mutual labels:  rspec
Rspec junit formatter
RSpec results that your CI can read
Stars: ✭ 255 (-30.33%)
Mutual labels:  rspec

Autodoc

CircleCI Gem Version

Generate documentation from your rack application & request-spec.

Installation

gem "autodoc", group: :test

If you want to generate toc_html, you should install redcarpet gem (optional).

gem "redcarpet", group: :test

Usage

Run rspec with AUTODOC=1 to generate documents for your request-specs tagged with :autodoc.
example: Autodoc generates doc/recipes.md and doc/toc.md from spec/requests/recipes_spec.rb.

# shell-command
AUTODOC=1 rspec

Examples

For any Rack application with rack-test

# spec/requests/entries_spec.rb
describe "Entries" do
  include Rack::Test::Methods

  let(:app) do
    MyRackApplication
  end

  describe "GET /entries", autodoc: true do
    it "returns entries" do
      get "/entries"
      last_response.status.should == 200
    end
  end
end

For Rails application with rspec-rails

# spec/requests/recipes_spec.rb
describe "Recipes" do
  describe "POST /recipes", autodoc: true do
    it "creates a new recipe" do
      post "/recipes", name: "alice", type: 1
      response.status.should == 201
    end
  end
end

Custom description

You can write more detailed descriptions with let(:description).

describe "Recipes" do
  describe "PUT /recipes/:id", autodoc: true do
    let(:description) do
      "Updates a recipe. `name` parameter is required."
    end

    it "updates a recipe" do
      put "/recipes/#{recipe.id}", name: "Bob"
      response.status.should == 204
    end
  end
end

Configuration

You can configure Autodoc.configuration to change its behavior:

  • path - [String] location to put files (default: ./doc)
  • suppressed_request_header - [Strings] filtered request header keys
  • suppressed_response_header - [Strings] filtered response header keys
  • template - [String] ERB template for each document (default: document.md.erb)
  • toc_template - [String] ERB template for ToC (default: toc.md.erb)
  • toc - [Boolean] whether to generate toc.md (default: false)
  • toc_html_template - [String] ERB template for html ToC (default: toc.html.erb)
  • toc_html - [Boolean] whether to generate toc.html - a single page documentation with a toc (default: false)
  • document_path_from_example - [Proc] specify a Proc to change the naming rule of document file paths
Autodoc.configuration.path = "doc/api"
Autodoc.configuration.toc = true
Autodoc.configuration.toc_html = true
Autodoc.configuration.template = File.read(File.expand_path("../autodoc/templates/document.md.erb", __FILE__))
Autodoc.configuration.document_path_from_example = -> (example) do
  example.file_path.gsub(%r<\./spec/requests/api/(.+)_spec\.rb>, '\1.md')
end

WeakParameters integration

If your app uses WeakParameters to define parameters schema in your controller, autodoc scans them and provides ### Parameters section to generated docs.

class RecipesController < ApplicationController
  validates :create do
    string :name, required: true, except: ["charlie", "dave"]
    integer :type, only: 1..3
  end
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].