Sha256: 6572c78bfaaafd672e2717f19509641ee84d79b4cf1100f0f12e80008552b3b3

Contents?: true

Size: 1.53 KB

Versions: 55

Compression:

Stored size: 1.53 KB

Contents

require 'test_helper'

module Vedeu

  module Geometry

    describe Grid do

      let(:described) { Vedeu::Geometry::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 { Vedeu::Geometry::Grid.columns(0) }.must_raise(Vedeu::Error::OutOfRange) }
        end

        context 'when the value is greater than 12' do
          it { proc { Vedeu::Geometry::Grid.columns(13) }.must_raise(Vedeu::Error::OutOfRange) }
        end

        context 'when the value is in range' do
          it 'returns the value of the column' do
            Vedeu::Geometry::Grid.columns(7).must_equal(42)
          end
        end
      end

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

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

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

    end # Grid

  end # Geometry

end # Vedeu

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
vedeu-0.6.60 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.59 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.58 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.57 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.56 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.54 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.53 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.52 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.51 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.50 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.49 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.48 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.47 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.46 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.45 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.44 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.43 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.42 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.41 test/lib/vedeu/geometry/grid_test.rb
vedeu-0.6.40 test/lib/vedeu/geometry/grid_test.rb