Sha256: 2e980f80f0c2771375b23c6e3cf2e6b6a297a8555f33cada1cb6be6c3ea6af43
Contents?: true
Size: 1.54 KB
Versions: 11
Compression:
Stored size: 1.54 KB
Contents
require 'test_helper' require 'vedeu/support/terminal' module Vedeu describe Terminal do let(:console) { IO.console } describe '.input' do it 'returns the entered string' do 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 '.clear_last_line' do it 'returns an escape sequence to clear the last line' do console.stub :winsize, [25, 25] do Terminal.clear_last_line.must_equal("\e[24;1H\e[2K") end end end describe '.centre' do it 'returns the centre point on the terminal' do 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.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.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.stub :winsize, [25, 80] do Terminal.size.must_equal([25, 80]) end end end describe '.console' do it 'returns the console' do Terminal.console.must_equal(console) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems