Fix object space matcher

This commit is contained in:
Markus Schirp 2012-09-15 23:23:53 +02:00
parent 933364b800
commit 96beff82b9
2 changed files with 4 additions and 10 deletions

View file

@ -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

View file

@ -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