N
N
nesutop2014-08-05 11:09:17
Ruby on Rails
nesutop, 2014-08-05 11:09:17

How to use the fdoc gem with grape?

Why can't fdoc scfold my documents? Fdoc: https://github.com/square/fdoc Grape: https://github.com/intridea/grape docs/fdoc folders created! app/api/my_api/base.rb
FDOC_SCAFFOLD=true bundle exec rspec spec/api

module Twitter
  class API < Grape::API
    version 'v1', using: :path, vendor: 'twitter'
    format :json

    get :ping do 
      {status: "ok"}
    end

  end
end

gemfile
...
gem 'fdoc'

gem 'rspec'
gem 'rack-test', require: 'rack/test'

spec/spec_helper.rb
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'rack/test'
require 'fdoc'

RSpec.configure do |config|
  config.infer_spec_type_from_file_location!
  config.raise_errors_for_deprecations!
  config.infer_base_class_for_anonymous_controllers = false
  config.order = 'random'
end

Example: https://github.com/square/fdoc/blob/master/docs/sc...
My:
spec/api/twiter_spec.rb
require 'spec_helper'
require 'fdoc/spec_watcher'

describe Twitter::API do
  include Fdoc::SpecWatcher

  describe "twitter", :fdoc => '/ping' do
    it "test ping" do
      get "twitter/v1/ping/"
      response.status.should == 200
    end
  end
end

If you don't want to deal with this, please provide a link to a simple and WORKING example of using fdoc.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question