[rspec-users] Getting past my login system

Scott Taylor scott at railsnewbie.com
Tue Jul 17 04:44:24 EDT 2007


> My apologies if this has been redundant. I did try reading through  
> other
> posts before posting my own, but I guess I did not understand how to
> apply what I read to what I have. I did attempt mocking a user  
> using the
> method suggested by Scott, but got an error stating:
> "Mock 'User_1000' received unexpected message :preferences wit (no  
> args)."

I'm glad you finally solved the problem (with the help of Daniel N).

I didn't mean to be condescending on the matter of reading the  
mailing list.  Authentication is a hard matter to deal with because  
of Rails complications.

As for mocks - you might want to google Martin Fowlers article about  
how "Mocks aren't stubs".  Every mock that receives an unexpected  
message (i.e. method call) will raise a MockExpectationError.  This  
is a sign that you should probably be stubbing those methods.

Regards,

Scott Taylor



More information about the rspec-users mailing list