Sha256: c15f5857b36b9114d9490e320f8d8fc1fb502a4fc53577547b612b157f578bf7
Contents?: true
Size: 1.15 KB
Versions: 9
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe Mutant::Matcher::Methods::Instance, '#each' do let(:object) { described_class.new(cache, Foo) } let(:cache) { Mutant::Cache.new } subject { object.each { |matcher| yields << matcher } } let(:yields) { [] } module Bar def method_d end def method_e end end class Foo include Bar private :method_d public def method_a end protected def method_b end private def method_c end end let(:subject_a) { mock('Subject A') } let(:subject_b) { mock('Subject B') } let(:subject_c) { mock('Subject C') } let(:subjects) { [subject_a, subject_b, subject_c] } before do matcher = Mutant::Matcher::Method::Instance matcher.stub(:new).with(cache, Foo, Foo.instance_method(:method_a)).and_return([subject_a]) matcher.stub(:new).with(cache, Foo, Foo.instance_method(:method_b)).and_return([subject_b]) matcher.stub(:new).with(cache, Foo, Foo.instance_method(:method_c)).and_return([subject_c]) end it 'should yield expected subjects' do subject yields.should eql(subjects) end it_should_behave_like 'an #each method' end
Version data entries
9 entries across 9 versions & 1 rubygems