Sha256: aded1acfa76d3b40fea89aab94e09706f623415f86f85ef96f79703cb049ec9c

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 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(Vedeu::OutOfRange) }
      end

      context 'when the value is greater than 12' do
        it { proc { Grid.columns(13) }.must_raise(Vedeu::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(Vedeu::OutOfRange) }
      end

      context 'when the value is greater than 12' do
        it { proc { Grid.rows(13) }.must_raise(Vedeu::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

11 entries across 11 versions & 1 rubygems

Version Path
vedeu-0.6.1 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.0 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.13 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.12 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.11 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.10 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.9 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.8 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.7 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.6 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.5.5 test/lib/vedeu/geometry/grid_test.rb