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
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
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
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
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