[rspec-users] spec'ing calls to super (or other Ruby keywords)

Matt McNeil nabble.108 at xoxy.net
Fri May 2 17:17:01 EDT 2008


Hi there,

How does one spec an invocation of a Ruby keyword, such as super in this
case?

class User < ActiveResource::Base
  # faking the ActiveRecord before/after_save observers
  def save
    super
    UserMailer.deliver_activation(self) if recently_activated?
  end
end

Does the solution look anything like the following?

describe User do
  describe '#save' do
    it "should call save on the parent class" do
      # something.should_receive(:something)
      @user.save
    end
  end
end

Any thoughts?

Thanks much,
Matt

-- 
View this message in context: http://www.nabble.com/spec%27ing-calls-to-super-%28or-other-Ruby-keywords%29-tp17027929p17027929.html
Sent from the rspec-users mailing list archive at Nabble.com.



More information about the rspec-users mailing list