[rspec-users] Help with spec controller

David Chelimsky dchelimsky at gmail.com
Tue Jun 5 11:59:15 EDT 2007


On 6/5/07, Gaston Ramos <gramos at rectorado.unl.edu.ar> wrote:
> Hello,
>
> I haven't been able to create a controller spec.
> You can see the code here:
>
> http://pastie.caboo.se/67980

Instead of this:

  Person.stub!(:save).and_return( @person )

do this:

  person.stub!(:save).and_return(true)

Please let us know if that fixes it.

>
> The error message I'm getting is:
>
> Spec::Mocks::MockExpectationError in 'PersonController should tell the Person
> model to create a new person on POST to create'
> Mock 'person' received unexpected message :save with (no args)
> /home/gramos/src/rails/dental/config/../app/controllers/person_controller.rb:26:in
> `create'
> ./spec/controllers/person_controller_spec.rb
>
> I can't find what I am doing wrong.
>
> I would appreciate any help. thanks in advance.
>
>
> --
> Gastón Ramos
>
> "I always thought Smalltalk would beat Java, I just didn't know it would be
> called 'Ruby' when it did."
>  -- Kent Beck
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list