Sha256: d80314821989539d3ad8cd0b15e4a04e065a8ebad04fc836d8f8b0896578857c

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

require 'test_helper'

module Vedeu

  describe Position do

    describe '#initialize' do
      it 'returns an instance of Position' do
        Position.new.must_be_instance_of(Position)
      end
    end

    describe '#to_s' do
      it 'returns an escape sequence when no coordinates are provided' do
        Position.new.to_s.must_equal("\e[1;1H")
      end

      it 'returns an escape sequence when coordinates are provided' do
        Position.new(12, 19).to_s.must_equal("\e[12;19H")
      end

      it 'resets to starting position when a block is given' do
        Position.new(4, 9).to_s { 'test' }.must_equal("\e[4;9Htest\e[4;9H")
      end
    end

  end # Position

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.2.11 test/lib/vedeu/support/position_test.rb
vedeu-0.2.10 test/lib/vedeu/support/position_test.rb