From 96beff82b99c1afb5a34b1ba8bd478c95d99e192 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sat, 15 Sep 2012 23:23:53 +0200 Subject: [PATCH] Fix object space matcher --- lib/mutant/matcher/object_space.rb | 3 --- spec/unit/mutant/matcher/object_space/each_spec.rb | 11 ++++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/mutant/matcher/object_space.rb b/lib/mutant/matcher/object_space.rb index 6a6ad2c9..dd6fc41f 100644 --- a/lib/mutant/matcher/object_space.rb +++ b/lib/mutant/matcher/object_space.rb @@ -94,9 +94,6 @@ module Mutant # def emit_scope_matches(scope, &block) @matchers.each do |matcher| - p scope - p matcher - p matcher.each(scope).to_a matcher.each(scope, &block) end end diff --git a/spec/unit/mutant/matcher/object_space/each_spec.rb b/spec/unit/mutant/matcher/object_space/each_spec.rb index 2d2e05b1..6f6d54df 100644 --- a/spec/unit/mutant/matcher/object_space/each_spec.rb +++ b/spec/unit/mutant/matcher/object_space/each_spec.rb @@ -7,8 +7,10 @@ describe Mutant::Matcher::ObjectSpace, '#each' do let(:object) { described_class.new(/\ATestApp::Literal(\z|::)/) } before do - Mutant::Matcher::Method::Singleton.stub(:each => [matcher_a]) - Mutant::Matcher::Method::Instance.stub(:each => [matcher_b]) + Mutant::Matcher::Method::Singleton.stub(:each).and_yield(matcher_a) + Mutant::Matcher::Method::Instance.stub(:each).and_yield(matcher_b) + matcher_a.stub(:each).and_yield(subject_a) + matcher_b.stub(:each).and_yield(subject_b) end @@ -18,11 +20,6 @@ describe Mutant::Matcher::ObjectSpace, '#each' do let(:subject_a) { mock('Subject A') } let(:subject_b) { mock('Subject B') } - before do - matcher_a.stub(:each).and_yield(subject_a).and_return(matcher_a) - matcher_b.stub(:each).and_yield(subject_b).and_return(matcher_b) - end - it_should_behave_like 'an #each method' it 'should yield subjects' do