Skip to content

Instantly share code, notes, and snippets.

@tomafro
Created January 21, 2011 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomafro/789707 to your computer and use it in GitHub Desktop.
Save tomafro/789707 to your computer and use it in GitHub Desktop.
context "when logged in" do
setup do
@account = Factory(:provisioned_account)
sign_in @account
end
context "GET index" do
setup do
@messages = 5.times.map { message(:subscriber => @account.subscriber, :favourite => true) }
end
should "assign page of favourite available messages to @favourites" do
@controller.expects(:available_messages).with(:favourite => true).returns(@messages)
@controller.expects(:page_of).with(@messages).returns(@messages.paginate)
get :index
assert_equal @messages.paginate, assigns(:favourites)
end
should render_template(:index)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment