Sha256: fb568b620f96d6e3beac667208aaa21b43cf1ac824646afd1cfd72b0eaaa9bf1

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 Bytes

Contents

require 'test_helper'

module Vedeu
  describe InterfaceCollection do
    describe '#coerce' do
      before { API::Store.reset }

      it 'returns an empty collection when there are no interfaces' do
        composition = Composition.new
        composition.interfaces.must_equal([])
      end

      it 'returns a collection when there is a single interface' do
        Vedeu.interface('dumb') {}

        composition = Composition.new(
          {
            interfaces: { name: 'dumb' }
          }
        )
        composition.interfaces.first.must_be_instance_of(Interface)
      end

      it 'returns a collection when there are multiple interfaces' do
        Vedeu.interface('dumb')   {}
        Vedeu.interface('dumber') {}

        composition = Composition.new(
          {
            interfaces: [
              { name: 'dumb' },
              { name: 'dumber' }
            ]
          }
        )
        composition.interfaces.size.must_equal(2)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.10 test/lib/vedeu/models/attributes/interface_collection_test.rb