Sha256: 2f2dbddf2930dba8ef88b078b19c15d5af8730ba20d8491d4655789083f0c244

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

require_relative '../../../../test_helper'

module Vedeu
  module Buffer
    describe Stream do
      let(:described_class)    { Stream }
      let(:described_instance) { described_class.new(attributes) }
      let(:subject)            { described_instance }
      let(:attributes)         {
        {
          style:      'normal',
          foreground: :red,
          background: :black,
          text:       'Some text'
        }
      }

      it 'returns a Stream instance' do
        subject.must_be_instance_of(Stream)
      end

      it 'has a foreground attribute' do
        subject.foreground.must_be_instance_of(Symbol)

        subject.foreground.must_equal(:red)
      end

      it 'has a background attribute' do
        subject.background.must_be_instance_of(Symbol)

        subject.background.must_equal(:black)
      end

      it 'has a text attribute' do
        subject.text.must_be_instance_of(String)

        subject.text.must_equal('Some text')
      end

      it 'has a style attribute' do
        subject.style.must_be_instance_of(Array)

        subject.style.must_equal([:normal])
      end

      describe '#to_compositor' do
        let(:subject) { described_instance.to_compositor }

        it 'returns a Hash' do
          subject.must_be_instance_of(Hash)

          subject.must_equal({
            style:  [:normal],
            colour: [:red, :black],
            text:   "Some text"
          })
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.0.25 test/lib/vedeu/output/buffer/stream_test.rb
vedeu-0.0.24 test/lib/vedeu/output/buffer/stream_test.rb