Sha256: cf6fc68d7f62e6ccf8e62db29082038aba4fcbd227783d6f89f848ebc084ee04

Contents?: true

Size: 1.83 KB

Versions: 23

Compression:

Stored size: 1.83 KB

Contents

require 'test_helper'

module Vedeu

  module Views

    describe Composition do

      let(:described)  { Vedeu::Views::Composition }
      let(:instance)   { described.new(attributes) }
      let(:attributes) {
        {
          client: client,
          colour: colour,
          parent: parent,
          style:  style,
          value:  _value,
        }
      }
      let(:client) {}
      let(:colour) {}
      let(:parent) {}
      let(:style)  {}
      let(:_value) {}

      describe '.build' do
        subject {
          described.build({}) do
            # ...
          end
        }

        it { subject.must_be_instance_of(described) }
      end

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@client').must_equal(client) }
        it { instance.instance_variable_get('@colour').must_equal(colour) }
        it { instance.instance_variable_get('@parent').must_equal(parent) }
        it { instance.instance_variable_get('@style').must_equal(style) }
        it { instance.instance_variable_get('@value').must_equal(_value) }
      end

      describe 'accessors' do
        it {
          instance.must_respond_to(:attributes)
          instance.must_respond_to(:parent)
          instance.must_respond_to(:value)
          instance.must_respond_to(:views)
        }
      end

      describe '#add' do
        let(:child) { Vedeu::Views::View.new }

        subject { instance.add(child) }

        it { instance.must_respond_to(:<<) }

        it { subject.must_be_instance_of(Vedeu::Views::ViewCollection) }
      end

      describe '#deputy' do
        subject { instance.deputy }

        it 'returns the DSL instance' do
          subject.must_be_instance_of(Vedeu::DSL::Composition)
        end
      end

    end # Composition

  end # Views

end # Vedeu

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
vedeu-0.6.50 test/lib/vedeu/models/views/composition_test.rb
vedeu-0.6.49 test/lib/vedeu/models/views/composition_test.rb
vedeu-0.6.48 test/lib/vedeu/models/views/composition_test.rb