Sha256: 8782214d1f7dc2029d2ef7ee8bff53aeaf7b90da3c27d15df5a5260475388038

Contents?: true

Size: 1.63 KB

Versions: 31

Compression:

Stored size: 1.63 KB

Contents

# frozen_string_literal: true

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

31 entries across 31 versions & 1 rubygems

Version Path
vedeu-0.8.32 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.31 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.30 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.29 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.28 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.27 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.26 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.25 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.24 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.23 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.22 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.21 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.20 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.19 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.18 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.17 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.16 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.15 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.14 test/lib/vedeu/geometries/dsl/grid_test.rb
vedeu-0.8.13 test/lib/vedeu/geometries/dsl/grid_test.rb