On Mon, May 17, 2010 at 9:32 PM, Kwang how Tan <[email protected]> wrote:
> Here are the failure messages, and the backtraces.
>
> Thx
>
> 1) SessionsController #create authenticate fail flash.now[:error] should
> be set to failure
> Failure/Error: flash.now[:error].should == "Invalid username or
> password!"
> expected: "Invalid username or password!",
> got: nil (using ==)
I think the problem here is that the expectation is set on flash.now,
but that's not how flash.now works - views still just access flash
(not flash.now). Try this:
it 'flash.now[:error] should be set to failure' do
post :create
flash[:error].should == "Invalid username or password!"
end
>
> 2) SessionsController #create authenticate successfully should redirect
> Failure/Error:
> expects(:redirect_to_target_or_default).with(twikets_path)
And in this case the expects message is being sent to the example
group, not the controller. Try:
controller.expects(:redirect_to_target_or_default).with(twikets_path)
HTH,
David
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users