Sha256: a65fdac202372986ed20b4ec39a42f0d28330b6fe4fcf30af9e53eb88312593f

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

require 'spec_helper'
class A
  def foo
  end

  include MethodWatcher

  def foo2
  end

  def foo3
  end

  watch_methods :foo, :foo3

  @overridden_methods = []

  def self.overridden_methods
    @overridden_methods
  end

  def self.method_overriding method
    self.overridden_methods << method
  end
end

class B < A
  def foo3
  end

  def foo
  end

  @overridden_methods = []

  watch_method :foo2

  def self.method_overriding method
    self.overridden_methods << method
    self.overridden_methods << :test
  end
end

class C < B
  def foo2
  end
end

describe MethodWatcher do
  it 'should right!' do
    A.overridden_methods.should == [:foo3, :foo]
    B.overridden_methods.should == [:foo2, :test]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
method_watcher-0.0.1 spec/method_watcher_spec.rb