how do I test named_scope with "expects" for controller?

0 views
Skip to first unread message

bezelga

unread,
Sep 9, 2009, 4:12:39 PM9/9/09
to Remarkable
Hello,

i'm stucked in a problem....

I have product model with the named_scopes: "active" and "for_sale"

In my controller i do something like:

product = Product.active.for_sale

And i want to test it with Remarkable....

I was trying to do something like:

expects :ative, :for_sale, :on => Product, :returns => mock_product

or

expects :ative, :with => :for_sale, :on => Product, :returns =>
mock_product

but does not work....

Any ideas of what do i need to do?

[]'s

José Valim

unread,
Sep 9, 2009, 4:16:02 PM9/9/09
to remarka...@googlegroups.com
Return the own class:

  expects :active, :on => Product, :returns => Product
  expects :for_sale, :on => Product, :returns => mock_product
--
José Valim

bezelga

unread,
Sep 9, 2009, 4:25:14 PM9/9/09
to Remarkable
Thanks!
Reply all
Reply to author
Forward
0 new messages