[rspec-users] received unexpected message :id= with (20)

Justin Ko jko170 at gmail.com
Thu May 24 06:28:26 UTC 2012


On May 23, 2012, at 4:27 PM, Kleber Shimabuku wrote:

> Please help me to understand this error message:
> 
> 1) PostsController#create when logged in should create a new post and
> redirect to a successful message page
>     Failure/Error: post 'create', { post: {title: 'New post',
>       Mock Post(id: integer, title: string, description: text,
> location: string, created_at: datetime, updated_at: datetime, status:
> string, tags: string, views: integer, user_id: integer) received
> unexpected message :id= with (20)

I'm guessing the `Post` mock is making its way to the model layer. Either way, you need to find out why `id=` is getting called.

Shot in the dark: There is a lot of "post" names there. Maybe there is a conflict?

>     # ./spec/controllers/posts_controller_spec.rb:56:in `block (4
> levels) in <top (required)>'
> 
> Finished in 0.59991 seconds
> 6 examples, 1 failure
> 
> 
> 
> I'm trying to figure out this for about a week or more :(
> 
> Attachments:
> http://www.ruby-forum.com/attachment/7429/posts_controller_spec.rb
> http://www.ruby-forum.com/attachment/7430/posts_controller.rb
> 
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list