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

Version Path
vedeu-0.4.16 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.15 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.14 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.13 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.12 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.11 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.10 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.9 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.8 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.7 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.6 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.5 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.4 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.3 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.2 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.1 test/lib/vedeu/support/grid_test.rb
vedeu-0.4.0 test/lib/vedeu/support/grid_test.rb
vedeu-0.3.5 test/lib/vedeu/support/grid_test.rb
vedeu-0.3.4 test/lib/vedeu/support/grid_test.rb