Sha256: c0faefbca412d2b930b826887320c6bb87cffd138248e10aebb9d601b7154135

Contents?: true

Size: 733 Bytes

Versions: 9

Compression:

Stored size: 733 Bytes

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

module Vedeu
  describe Grid do
    describe '.columns' do
      it 'raises an exception if the value is less than 1' do
        proc { Grid.columns(0) }.must_raise(OutOfRange)
      end

      it 'raises an exception if the value is greater than 12' do
        proc { Grid.columns(13) }.must_raise(OutOfRange)
      end

      it 'returns the width if the value is in range' do
        IO.console.stub :winsize, [25, 80] do
          Grid.columns(7).must_equal(42)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.2.4 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.3 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.2 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.1 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.0 test/lib/vedeu/support/grid_test.rb
vedeu-0.1.19 test/lib/vedeu/support/grid_test.rb
vedeu-0.1.18 test/lib/vedeu/support/grid_test.rb
vedeu-0.1.17 test/lib/vedeu/support/grid_test.rb
vedeu-0.1.16 test/lib/vedeu/support/grid_test.rb