Skip to content

Instantly share code, notes, and snippets.

@apraditya
apraditya / books_controller.rb
Created February 20, 2012 03:07
An example of how rapi_doc is setup
class BooksController < ApplicationController
# GET /books
# GET /books.json
#=begin apidoc
#url:: /books
#method:: GET
#access:: FREE
#return:: [JSON|XML] - list of book objects
#param:: page:int - the page, default is 1
#param:: per_page:int - max items per page, default is 10
$ rake -T
(in /Users/apraditya/Work/my_os_projects/rapi_doc)
rake aborted!
uninitialized constant Rake::DSL
/Users/apraditya/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/Users/apraditya/.rvm/gems/ruby-1.9.2-p180@rapidoc/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/Users/apraditya/.rvm/gems/ruby-1.9.2-p180@rapidoc/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
/Users/apraditya/.rvm/gems/ruby-1.9.2-p180@rapidoc/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top (required)>'
/Users/apraditya/.rvm/gems/ruby-1.9.2-p180@rapidoc/gems/jeweler-1.6.4/lib/jeweler/tasks.rb:2:in `require'
/Users/apraditya/.rvm/gems/ruby-1.9.2-p180@rapidoc/gems/jeweler-1.6.4/lib/jeweler/tasks.rb:2:in `<top (required)>'
require 'spec_helper'
describe SubscriptionsController do
context "Actions" do
before do
stub_out_user(controller, @user = Factory.stub(:user))
@plan = Factory(:plan)
@params = {}
end
expected #<Subscription id: nil, plan_id: 2, user_id: nil, stripe_customer_token: nil, created_at: nil, updated_at: nil, status: nil, canceled_at: nil, period_end_at: nil>
got #<Subscription id: nil, plan_id: 2, user_id: nil, stripe_customer_token: nil, created_at: nil, updated_at: nil, status: nil, canceled_at: nil, period_end_at: nil>