Sha256: f63df19cf2d6f991c750f08a5086e396a0ba6ea4c791dba5f8a76257ca1fd3ab

Contents?: true

Size: 763 Bytes

Versions: 6

Compression:

Stored size: 763 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 # Fixnum

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 # Grid

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.2.10 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.9 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.8 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.7 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.6 test/lib/vedeu/support/grid_test.rb
vedeu-0.2.5 test/lib/vedeu/support/grid_test.rb