0.0
No commit activity in last 3 years
No release in over 3 years
Provides helper methods for RSpec that help you test methods that call super
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.3.0
>= 0.5.4

Runtime

>= 1.3.0
 Project Readme

RSpec Super

Git: http://github.com/mattdenner/rspec_super Author: Matthew Denner Copyright: 2010 License: MIT Licence

Overview

This gem provides RSpec with a way for testing methods that call super. Consider this:

class Base
  def do_something
  end
end

class Derived < Base
  def do_something
    super
    do_something_else
  end

  def do_something_else
  end
end

How do you go about testing Derived#do_something without having to duplicate your Base#do_something tests?

With this gem you can use {Spec::Mocks::Methods#should_receive_super_of should_receive_super_of} and the standard RSpec expectations, just like this:

describe Derived do
  before(:each) do
    @object = described_class.new
  end

  describe '#do_something' do
    it 'calls super' do
      @object.should_receive_super_of(:do_something).once
      @object.should_receive(:do_something_else).once
      @object.do_something
    end
  end
end

Word of warning!

This is very very alpha code and has only been tested with RSpec 1.3.0 and on Ruby 1.9.1. You should be alright to use it on Ruby 1.8.7 but don't quote me on the RSpec support for earlier versions!

Copyright

RSpec Super © 2010 by Matthew Denner. RSpec Super is licensed under the MIT license.