Stub of a class level method handled by method_missing does not get cleared #15

Mori opened this Issue Feb 25, 2011 · 4 comments


None yet
4 participants

Mori commented Feb 25, 2011

I have run into the issue reported here and demonstrated here. Is there a work-around for this? Has this changed in rspec 2?

Thank you for rspec!


patmaddox commented Feb 25, 2011

this is fixed in rspec 2

aselder commented Mar 3, 2011

The error I believe was introducted in RSpec 1.3.1 with the following two lines in proxy.rb

    elsif @target.is_a?(Class)
      @target.superclass.send(sym, *args, &block)

So when the proxy tries to forward it, it goes to the superclass rather than falling down to a send to method_missing.

aselder commented Mar 3, 2011

A solution that seems to work for me is to change line 114 of proxy.rb to:

elsif @target.is_a?(Class) && @target.superclass.respond_to?(sym, true)

dchelimsky commented Mar 4, 2011

Closed by c723627

@mrkn mrkn pushed a commit to mrkn/rspec that referenced this issue Apr 20, 2011

@dchelimsky Andrew Selder + dchelimsky Only try to pass messages to the superclass if the superclass respond…
…s to the method

Fixes LH Bug #1049 and GH Bug #15 and #17

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment