Sha256: 1f1bd76deaa43a76efe7fb97a6691ee976f6a8ff0e269b08934978b83ab17a27
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
require 'test_helper' module Vedeu describe Position do let(:described) { Vedeu::Position } let(:instance) { described.new(12, 19) } describe '#initialize' do subject { instance } it { subject.must_be_instance_of(Position) } it { subject.instance_variable_get('@y').must_equal(12) } it { subject.instance_variable_get('@x').must_equal(19) } end describe '#to_s' do # subject { described.new.to_s } 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 'returns an escape sequence if a coordinate is missing' do Position.new(12).to_s.must_equal("\e[12;1H") end it 'returns an escape sequence if the x coordinate is negative' do Position.new(12, -5).to_s.must_equal("\e[12;1H") end it 'returns an escape sequence if the y coordinate is negative' do Position.new(-12, 5).to_s.must_equal("\e[1;5H") 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.3.2 | test/lib/vedeu/support/position_test.rb |
vedeu-0.3.1 | test/lib/vedeu/support/position_test.rb |
vedeu-0.3.0 | test/lib/vedeu/support/position_test.rb |