Sha256: aa1a30a50d1724fd01bbc8f55b45bf623d174dfa3fe5cfe8f4fbee9ce81d398a

Contents?: true

Size: 889 Bytes

Versions: 18

Compression:

Stored size: 889 Bytes

Contents

require 'spec_helper'

describe Mutant::Matcher::ObjectSpace, '#each' do
  before do
    pending "defunct"
  end
  subject { object.each { |item| yields << item } }

  let(:yields) { []                                               }
  let(:object) { described_class.new(/\ATestApp::Literal(\z|::)/) }

  before do
    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


  let(:matcher_a) { mock('Matcher A') }
  let(:matcher_b) { mock('Matcher B') }

  let(:subject_a) { mock('Subject A') }
  let(:subject_b) { mock('Subject B') }
  
  it_should_behave_like 'an #each method'

  it 'should yield subjects' do
    expect { subject }.to change { yields }.from([]).to([subject_a, subject_b])
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mutant-0.2.20 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.17 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.16 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.15 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.14 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.13 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.12 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.11 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.9 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.8 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.7 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.6 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.5 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.4 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.3 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.2 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.1 spec/unit/mutant/matcher/object_space/each_spec.rb
mutant-0.2.0 spec/unit/mutant/matcher/object_space/each_spec.rb