[rspec-users] Controller spec with devise.

David Chelimsky dchelimsky at gmail.com
Thu Aug 26 09:28:54 EDT 2010


On Aug 24, 2010, at 6:51 PM, Titinux wrote:

> Hello,
> 
> I'm new in using RSpec and I can't figured out to spec this controller
> action.
> 
> class OrdersController < ApplicationController
>  before_filter :authenticate_user!
> 
>  def index
>    respond_with(@orders = current_user.orders)
>  end
> end
> 
> When I want to spec this "@assets = Asset.all" I use "Asset.stub(:all)
> { [mock_asset] }" as I read in the RSpec book but with
> "current_user.orders" I don't know how to do.
> 
> NB: I'm using Rails 3.0.0.rc2 and RSpec 2.0.0.beta.20

What is the behaviour you want to specify?


More information about the rspec-users mailing list