Sha256: 9c8b6ba1f75f96a74f5e48968c948913d54104d91bcb7a1fbfa011bd7eaae1d7

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

require 'test_helper'

module Vedeu

  module DSL

    describe Line do

      let(:described) { Vedeu::DSL::Line }
      let(:instance)  { described.new(model) }
      let(:model)     { Vedeu::Line.new(attributes) }
      let(:attributes){
        {
          streams: streams,
          parent:  parent,
          colour:  colour,
          style:   style,
        }
      }
      let(:client)    {}
      let(:streams)   { [] }
      let(:parent)    { Vedeu::Interface.new }
      let(:colour)    { Vedeu::Colour.new }
      let(:style)     { Vedeu::Style.new }

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@model').must_equal(model) }
        it { instance.instance_variable_get('@client').must_equal(client) }
      end

      describe '#line' do
        let(:value) { '' }

        subject {
          instance.line do
            # ...
          end
        }

        it { subject.must_be_instance_of(Vedeu::Lines) }
        it { subject.first.must_be_instance_of(Vedeu::Line) }
      end

      describe '#streams' do
        context 'when the block is given' do
          subject {
            instance.streams do
              # ...
            end
          }

          it { subject.must_be_instance_of(Vedeu::Streams) }
          it { subject.first.must_be_instance_of(Vedeu::Stream) }
        end

        context 'when the block is not given' do
          it { proc { instance.streams }.must_raise(InvalidSyntax) }
        end
      end

    end # Line

  end # DSL

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.3.4 test/lib/vedeu/dsl/line_test.rb