Sha256: bf94e392ac8f36145c19b7e49d21f5da47414032d1675468c40515681062112b

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

require_relative '../../../test_helper'
require_relative '../../../../lib/vedeu/support/terminal'

module Vedeu
  describe Terminal do
    describe '.input' do
      it 'returns the entered string' do
        console = IO.console
        console.stub :gets, "test\n" do
          Terminal.input.must_equal('test')
        end
      end
    end

    describe '.output' do
      it 'returns the output' do
        Terminal.output.must_equal('')
      end
    end

    describe '.centre' do
      it 'returns the centre point on the terminal' do
        console = IO.console
        console.stub :winsize, [25, 80] do
          Terminal.centre.must_equal([12, 40])
        end
      end
    end

    describe '.width' do
      it 'returns the width of the terminal' do
        console = IO.console
        console.stub :winsize, [25, 80] do
          Terminal.width.must_equal(80)
        end
      end
    end

    describe '.height' do
      it 'returns the height of the terminal' do
        console = IO.console
        console.stub :winsize, [25, 80] do
          Terminal.height.must_equal(25)
        end
      end
    end

    describe '.size' do
      it 'returns the width and height of the terminal' do
        console = IO.console
        console.stub :winsize, [25, 80] do
          Terminal.size.must_equal([25, 80])
        end
      end
    end

    describe '.console' do
      it 'returns the console' do
        console = IO.console
        Terminal.console.must_equal(console)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.36 test/lib/vedeu/support/terminal_test.rb
vedeu-0.0.35 test/lib/vedeu/support/terminal_test.rb
vedeu-0.0.34 test/lib/vedeu/support/terminal_test.rb
vedeu-0.0.33 test/lib/vedeu/support/terminal_test.rb