spy icon indicating copy to clipboard operation
spy copied to clipboard

Prepended modules cause spy to think a method has never been hooked

Open sgrif opened this issue 9 years ago • 3 comments
trafficstars

Steps to reproduce:

class Foo
  class << self
    prepend Bar
  end

  def self.foo
  end
end

module Bar
  def foo
  end
end

class Test < MiniTest::Test
  def test_stuff
    Spy.on(Foo, :bar)
  end
end

Spy will continuously complain that Foo.bar hasn't been hooked, and will continue to do so for every subsequent test run as it continuously tries to unhook the method.

sgrif avatar Aug 29 '16 15:08 sgrif

oooo, yea haven't tested this in 2.3 at all yet and .prepend I'll see if I can make some time soon to get it working.

ryanong avatar Aug 29 '16 20:08 ryanong

Pretend was actually in 2.0. ;)

On Mon, Aug 29, 2016, 4:00 PM Ryan Ong [email protected] wrote:

oooo, yea haven't tested this in 2.3 at all yet and .prepend I'll see if I can make some time soon to get it working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ryanong/spy/issues/7#issuecomment-243237563, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdWK7MmlaNaWrhOVFmh5va5VzR6vYdHks5qkzpVgaJpZM4Jvmhf .

sgrif avatar Aug 29 '16 20:08 sgrif

Prepend* damn autocorrect

On Mon, Aug 29, 2016, 4:23 PM Sean Griffin [email protected] wrote:

Pretend was actually in 2.0. ;)

On Mon, Aug 29, 2016, 4:00 PM Ryan Ong [email protected] wrote:

oooo, yea haven't tested this in 2.3 at all yet and .prepend I'll see if I can make some time soon to get it working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ryanong/spy/issues/7#issuecomment-243237563, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdWK7MmlaNaWrhOVFmh5va5VzR6vYdHks5qkzpVgaJpZM4Jvmhf .

sgrif avatar Aug 29 '16 20:08 sgrif