Sha256: 2d9a97e40238bc47fdca235ec01900cd8be6be4f80ce6d32c038878d3922596b

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 Bytes

Contents

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

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

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

3 entries across 3 versions & 1 rubygems

Version Path
compo-0.3.1 spec/composite_spec.rb
compo-0.3.0 spec/composite_spec.rb
compo-0.2.0 spec/composite_spec.rb