Sha256: 7a002db6c0c4f2158b40754f4b82bb154e5f038fe91146ba0e1bc3f351f5a3d7

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require_relative '../../../test_helper'
require_relative '../../../../lib/vedeu/models/interface_collection'
require_relative '../../../../lib/vedeu/models/composition'

module Vedeu
  describe InterfaceCollection do
    let(:described_class) { InterfaceCollection }

    describe '#coerce' do
      let(:subject)    { Vedeu::Composition.new({ interfaces: interfaces }).interfaces }
      let(:interfaces) {}

      context 'when there are no interfaces' do
        it 'returns a Array' do
          subject.must_be_instance_of(Array)
        end

        it 'returns an empty array' do
          subject.must_equal([])
        end
      end

      context 'when there is a single interface' do
        let(:interfaces) { { name: 'dummy' } }

        it 'returns an Interface' do
          subject.must_be_instance_of(Array)
        end

        it 'contains a single Interface object' do
          subject.size.must_equal(1)
        end
      end

      context 'when there are multiple interfaces' do
        let(:interfaces) {
          [
            { name: 'dumb' },
            { name: 'dumber' }
          ]
        }

        it 'returns an Array' do
          subject.must_be_instance_of(Array)
        end

        it 'returns a collection of Interface objects' do
          subject.first.must_be_instance_of(Interface)
        end

        it 'contains multiple Line objects' do
          subject.size.must_equal(2)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.29 test/lib/vedeu/models/interface_collection_test.rb
vedeu-0.0.28 test/lib/vedeu/models/interface_collection_test.rb
vedeu-0.0.27 test/lib/vedeu/models/interface_collection_test.rb
vedeu-0.0.26 test/lib/vedeu/models/interface_collection_test.rb