Sha256: 6e0d9c74121e35c0d2f98b820d8a1e81899e3e66056703bb423fa5e5f4ec9adc

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 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
  module API
    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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.1.15 test/lib/vedeu/api/grid_test.rb
vedeu-0.1.14 test/lib/vedeu/api/grid_test.rb
vedeu-0.1.13 test/lib/vedeu/api/grid_test.rb
vedeu-0.1.12 test/lib/vedeu/api/grid_test.rb
vedeu-0.1.10 test/lib/vedeu/api/grid_test.rb