[rspec-users] [newbie]: How to test for operations inside a block?
lists at ruby-forum.com
Mon Sep 22 13:40:10 EDT 2008
First off, thanks a lot for your reply!
Mark Wilden wrote:
> On Mon, Sep 22, 2008 at 9:07 AM, Carmine Moleti
> <lists at ruby-forum.com>wrote:
>> redirect_to users_path
>> redirect_to new_user_path
> The first thing I would do would be to refactor this code into the User
> model. The controller shouldn't be concerned with assigning the
> for example.
Care to explain a little more?
I left the code in the controller because it's the controller that knows
the context in which the gets created.
Should I have written one or more class methods on User to accomplish
of setting properties properly?
"user_type" is something I forgot to remove, and it has been replaced by
> Others may have more insight, but I would want to know what the specific
> complaints were.
The error shown is:
Mock 'User' expected :save with (false) once, but received it 0 times
Posted via http://www.ruby-forum.com/.
More information about the rspec-users