Sha256: e31e7f01ad1d3326ef0a84a09673a011be76eb849c06496e6081fb00132aab80

Contents?: true

Size: 1.26 KB

Versions: 19

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

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(described) }
      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

    describe '.rows' do
      context 'when the value is less than 1' do
        it { proc { Grid.rows(0) }.must_raise(OutOfRange) }
      end

      context 'when the value is greater than 12' do
        it { proc { Grid.rows(13) }.must_raise(OutOfRange) }
      end

      context 'when the value is in range' do
        it 'returns the value of the row' do
          Grid.rows(7).must_equal(14)
        end
      end
    end

  end # Grid

end # Vedeu

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
vedeu-0.5.4 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.3 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.2 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.1 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.0 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.65 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.64 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.63 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.62 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.61 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.60 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.59 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.58 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.57 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.56 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.55 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.54 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.53 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.4.52 test/lib/vedeu/geometry/grid_test.rb