Stubbing #desc

2 views
Skip to first unread message

Nick

unread,
Jun 19, 2012, 7:07:42 PM6/19/12
to rs...@googlegroups.com
Hi guys. When I stub a method chain that includes a method named "desc", Ruby complains:

private method `desc' called for #<Object:0xd1441e8>

Is there any way around this? As far as I know, #desc is a private method that RSpec adds to mocks. I'm using rspec-rails 2.10.1 .

Here's the code:
  ProductHave.for_sale.limit(20).desc('sale_config.created_at').each do |ph|

And here's the stub:
  ProductHave.stub_chain(:for_sale, :limit, :desc).
    and_return [ph1, ph2, ph3, ph4, ph5, ph6]

Thanks!
Nick
Reply all
Reply to author
Forward
0 new messages