Sha256: e05f877dad2b8bf8ccc51748c5f8b2362b2081a8e88551074ccc3382910db128

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

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

module Vedeu
  describe Output do
    let(:described_class) { Output }
    let(:subject)         { described_class.new }
    let(:output)          {}

    before do
      InterfaceRepository.create({ name: 'dummy', width: 15, height: 2, cursor: true })
      Terminal.stubs(:output).returns(output)
    end

    after { InterfaceRepository.reset }

    it 'returns an Output instance' do
      subject.must_be_instance_of(Output)
    end

    describe '.render' do
      let(:subject) { described_class.render }

      context 'when the interfaces have content' do
        let(:output) {
          [
            [
              "\e[38;2;39m\e[48;2;49m\e[1;1H               \e[1;1HTesting Outpu...\e[0m\e[38;2;39m\e[48;2;49m\e[?25h",
              "\e[38;2;39m\e[48;2;49m\e[2;1H               \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
            ]
          ]
        }

        before { Compositor.arrange({ 'dummy' => 'Testing Output.render' }) }

        it { subject.must_equal(output) }
      end

      context 'when the interfaces have no content' do
        let(:output) {
          [
            [
              "\e[38;2;39m\e[48;2;49m\e[1;1H               \e[1;1H\e[38;2;39m\e[48;2;49m\e[?25h",
              "\e[38;2;39m\e[48;2;49m\e[2;1H               \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
            ]
          ]
        }

        it { subject.must_equal(output) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.22 test/lib/vedeu/output/output_test.rb