Re: [rspec-users] Controller spec with devise.

2010-08-27 Thread Justin Ko
This is how I do it: before { sign_in(user_record) } describe "#index" do before do controller.current_user.stub(:orders) { ... } end it "..." do get :index end end Hope that helps. On Aug 24, 7:51 pm, Titinux wrote: > Hello, > > I'm new in using RSpec and I can't figured out

Re: [rspec-users] Controller spec with devise.

2010-08-27 Thread David Chelimsky
On Aug 27, 2010, at 5:35 AM, Titinux wrote: > I tink it's @orders should be an array of orders from > current_user.orders. > > describe OrdersController do > include Devise::TestHelpers > > def mock_order(stubs={}) >@mock_order ||= mock_model(Order, stubs).as_null_object > end > > desc

Re: [rspec-users] Controller spec with devise.

2010-08-27 Thread Titinux
I tink it's @orders should be an array of orders from current_user.orders. describe OrdersController do include Devise::TestHelpers def mock_order(stubs={}) @mock_order ||= mock_model(Order, stubs).as_null_object end describe "GET index" do it "assigns user's orders to @orders" d

Re: [rspec-users] Controller spec with devise.

2010-08-26 Thread Matt Wynne
David Chelimsky wrote: >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_wi

Re: [rspec-users] Controller spec with devise.

2010-08-26 Thread David Chelimsky
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) > en