Sha256: cf007e28bbf8dc443f32ccdaec2e314d70984af147f724a1cc71aeeb91cb4f2c

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 Bytes

Contents

require 'spec_helper'
require 'compo'
require 'composite_shared_examples'

# Mock implementation of a Composite
class MockComposite
  include Compo::Composites::Composite
end

RSpec.describe MockComposite do
  before(:each) { allow(subject).to receive(:children).and_return(children) }
  let(:children) { { in_children: child } }
  let(:child) { double(:child) }

  it_behaves_like 'a composite'
  it_behaves_like 'a composite with default #remove!'
  it_behaves_like 'a composite with default #remove_id!'

  #
  # Specifications for Composite's default behaviour.
  #
  describe '#get_child' do
    it 'calls #children' do
      expect(subject).to receive(:children).once
      subject.get_child(:in_children)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compo-0.5.1 spec/composite_spec.rb
compo-0.5.0 spec/composite_spec.rb