Sha256: c8d38b5ac9bf9249c6902caa25d602696f85a56932028550a7883906f24bdaf0
Contents?: true
Size: 1.04 KB
Versions: 19
Compression:
Stored size: 1.04 KB
Contents
require 'test_helper' describe Fixnum do describe '#columns' do it 'returns the width if the value is in range' do IO.console.stub :winsize, [25, 60] do 1.columns.must_equal(5) end end end end # Fixnum module Vedeu describe Grid do let(:described) { Vedeu::Grid } let(:instance) { described.new(value) } let(:value) { 2 } before { IO.console.stubs(:winsize).returns([25, 80]) } describe '#initialize' do it { instance.must_be_instance_of(Grid) } it { instance.instance_variable_get('@value').must_equal(value) } end describe '.columns' do context 'when the value is less than 1' do it { proc { Grid.columns(0) }.must_raise(OutOfRange) } end context 'when the value is greater than 12' do it { proc { Grid.columns(13) }.must_raise(OutOfRange) } end context 'when the value is in range' do it 'returns the value of the column' do Grid.columns(7).must_equal(42) end end end end # Grid end # Vedeu
Version data entries
19 entries across 19 versions & 1 rubygems