free_mutant/spec/unit/mutant/matcher/scope_spec.rb
Markus Schirp 8233c5871f Reduce matcher interface
* New primary interface #call makes specs and implementations much
  easier
* We had #each mostly for historical reasons that are not relevant
  anymore
* Mutation covers the Mutant::Matcher namespace
2015-10-28 20:13:00 +00:00

33 lines
991 B
Ruby

RSpec.describe Mutant::Matcher::Scope, '#call' do
let(:scope) { TestApp }
let(:object) { described_class.new(scope) }
let(:env) { instance_double(Mutant::Env) }
let(:matcher_a) { instance_double(Mutant::Matcher) }
let(:matcher_b) { instance_double(Mutant::Matcher) }
let(:subject_a) { instance_double(Mutant::Subject) }
let(:subject_b) { instance_double(Mutant::Subject) }
subject { object.call(env) }
before do
expect(Mutant::Matcher::Methods::Singleton).to receive(:new)
.with(scope)
.and_return(matcher_a)
expect(Mutant::Matcher::Methods::Instance).to receive(:new)
.with(scope)
.and_return(matcher_b)
expect(matcher_a).to receive(:call)
.with(env)
.and_return([subject_a])
expect(matcher_b).to receive(:call)
.with(env)
.and_return([subject_b])
end
it 'concatenates subjects from matched singleton and instance methods' do
should eql([subject_a, subject_b])
end
end