Sha256: 7a4169ae67136397fde1159c5ef08eb85379e9db20d9c9ef043cbeb82e45d015

Contents?: true

Size: 806 Bytes

Versions: 24

Compression:

Stored size: 806 Bytes

Contents

RSpec.describe Mutant::Matcher::Chain do

  let(:object) { described_class.new(matchers) }

  describe '#each' do
    let(:yields) { [] }
    subject { object.each { |entry| yields << entry } }

    let(:matchers) { [matcher_a, matcher_b] }

    let(:matcher_a) { [subject_a] }
    let(:matcher_b) { [subject_b] }

    let(:subject_a) { double('Subject A') }
    let(:subject_b) { double('Subject B') }

    # it_should_behave_like 'an #each method'
    context 'with no block' do
      subject { object.each }

      it { should be_instance_of(to_enum.class) }

      it 'yields the expected values' do
        expect(subject.to_a).to eql(object.to_a)
      end
    end

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
mutant-0.8.7 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.6 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.5 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.4 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.3 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.2 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.1 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.8.0 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.9 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.8 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.7 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.6 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.5 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.4 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.3 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.2 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.7.1 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.6.7 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.6.6 spec/unit/mutant/matcher/chain_spec.rb
mutant-0.6.5 spec/unit/mutant/matcher/chain_spec.rb