Skip to content

Instantly share code, notes, and snippets.

@JonCrawford
Forked from mhfs/My action.rb
Created November 1, 2009 00:23
Show Gist options
  • Save JonCrawford/223330 to your computer and use it in GitHub Desktop.
Save JonCrawford/223330 to your computer and use it in GitHub Desktop.
def index
@assets = current_account.assets.paginate :page => params[:page], :per_page => 10
end
# How to spec this???
before(:each) do
@account = Account.new
@assets = [Asset.new(:account => @account)]
end
it "should paginate the assets"
@controller.should_receive(:current_account).and_return(@account)
@account.should_receive(:assets).and_return(@assets)
@assets.should_receive(:paginate)
end
# controller action ..
def index
@tasks = Task.all
end
# spec ....
describe :get => :index do
expects :find, :on => Task, :with => :all, :returns => mock_task
should_assign_to :tasks, :with => mock_task
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment