From ad972bcc0018f6b241f1e786fc4205c0882ab557 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 6 Jul 2014 02:42:38 +0000 Subject: [PATCH] Add an example for method matching on memoizer --- spec/unit/mutant/matcher/method/instance_spec.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/spec/unit/mutant/matcher/method/instance_spec.rb b/spec/unit/mutant/matcher/method/instance_spec.rb index d432b5b7..a67e1800 100644 --- a/spec/unit/mutant/matcher/method/instance_spec.rb +++ b/spec/unit/mutant/matcher/method/instance_spec.rb @@ -8,7 +8,7 @@ describe Mutant::Matcher::Method::Instance do describe '#each' do 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(:yields) { [] } let(:namespace) { self.class } @@ -36,6 +36,19 @@ describe Mutant::Matcher::Method::Instance do it_should_behave_like 'a method matcher' 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 'on differend lines' do let(:base) { __LINE__ }