From: Chuck Remes Date: 2008-10-28T04:10:22+09:00 Subject: Re: how to detect if #super exists? On Oct 27, 2008, at 10:33 AM, Brian Candler wrote: > Chuck Remes wrote: >> What is the proper way to check for the existence of a #super method >> before invoking it? > > Hmm, how are you testing instance methods of a module without actually > mixing them into an object? > > Maybe it would be easier just to have a fake superclass for testing, > with stubs for those methods. (Indeed, then you can test that super > *is* > actually being called) My specs have an anonymous class that I create in the #before block. e.g. before(:each) do @base = Class.new do # set instance variables, etc. end.new @base.extend MyModule end it "should call #foo" do ... end Looks like #defined?(super) was what I needed. Thanks for the help. cr