Add an example for method matching on memoizer

This commit is contained in:
Markus Schirp 2014-07-06 02:42:38 +00:00
parent 68e983d357
commit ad972bcc00

View file

@ -8,7 +8,7 @@ describe Mutant::Matcher::Method::Instance do
describe '#each' do describe '#each' do
subject { object.each { |subject| yields << subject } } subject { object.each { |subject| yields << subject } }
let(:object) { described_class.new(env, scope, method) } let(:object) { described_class.build(env, scope, method) }
let(:method) { scope.instance_method(method_name) } let(:method) { scope.instance_method(method_name) }
let(:yields) { [] } let(:yields) { [] }
let(:namespace) { self.class } let(:namespace) { self.class }
@ -36,6 +36,19 @@ describe Mutant::Matcher::Method::Instance do
it_should_behave_like 'a method matcher' it_should_behave_like 'a method matcher'
end end
context 'when method is defined once with a memoizer' do
let(:base) { __LINE__ }
class self::Foo
def bar; end
include Adamantium
memoize :bar
end
let(:method_line) { 2 }
it_should_behave_like 'a method matcher'
end
context 'when method is defined multiple times' do context 'when method is defined multiple times' do
context 'on differend lines' do context 'on differend lines' do
let(:base) { __LINE__ } let(:base) { __LINE__ }