Sha256: f5a00552478094375aea4cf7d3304a10509cb13f799d1cebb6cf0f79aa9dc0bc

Contents?: true

Size: 1.83 KB

Versions: 5

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 do
          instance.must_respond_to(:attributes)
          instance.must_respond_to(:parent)
          instance.must_respond_to(:value)
          instance.must_respond_to(:views)
        end
      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

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.7.4 test/lib/vedeu/views/composition_test.rb
vedeu-0.7.3 test/lib/vedeu/views/composition_test.rb
vedeu-0.7.2 test/lib/vedeu/views/composition_test.rb
vedeu-0.7.1 test/lib/vedeu/views/composition_test.rb
vedeu-0.7.0 test/lib/vedeu/views/composition_test.rb