Sha256: 95e3dc79be20609ebe69362e4b70bdc91cbf9d1d1a4fcbc864c5b897c262f51e

Contents?: true

Size: 1.6 KB

Versions: 17

Compression:

Stored size: 1.6 KB

Contents

require 'test_helper'

module Vedeu

  module Geometries

    describe Grid do

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

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

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

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

    end # Grid

  end # Geometries

end # Vedeu

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
vedeu-0.8.0 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.7.4 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.7.3 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.7.2 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.7.1 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.7.0 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.6.71 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.6.70 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.6.69 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.6.68 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.67 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.66 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.65 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.64 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.63 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.62 test/lib/vedeu/geometries/grid_test.rb
vedeu-0.6.61 test/lib/vedeu/geometries/grid_test.rb