[rspec-users] testing call to super in rails helper

Ivor Paul ivorpaul at gmail.com
Tue Dec 9 06:29:51 EST 2008


I have the following code:

  def will_paginate(items, options = {})
    options = options.merge(:container => true, :class => 'paging')
    super(items, options)

I am curious about how to test that the call to super is infact being called
with the added options.

I have this

  it 'should call super on will_paginate' do
    helper.stub!(:will_paginate).with([], {:container => true, :class =>
    helper.should_receive(:will_paginate).with([], {:container => true,
:class => 'paging'})

But it fails as will_paginate is called with [] before being called with
([], {:container => true, :class => 'paging'})

I am relatively new to rspec, but trying to learn more - if there is a blog
post on how to deal with these situations, please point me in the right

Help much appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081209/e9f0e080/attachment.html>

More information about the rspec-users mailing list