Sha256: 1b6c91777aceca9b6a8732fe3a7beb63a36c008216485678ec9dd2fcb6687f4a

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
require 'abstracta'

include Abstracta

describe TerritoryDeveloper do
  
  let(:territory) { Territory.new }
  subject { TerritoryDeveloper.new(territory) }

  describe "#step" do
    it "should age occupants" do
      expect { subject.step }.to change { subject.first.age }.by 1
    end

    #it "should grow to a specific location" do
    #  expect { subject.step([[0,1]]) }.to change { subject.size }.by(1)
    #end

    let(:cycle) { subject.period }

    it "should grow total size" do
      expect { cycle.times { subject.step } }.to change { subject.size }.by(subject.growth.to_i)
    end

    context "longterm growth behaviors" do
      before { cycle.times { subject.step }}

      it 'should generate occupants with valid positions' do
	subject.each do |occupant|
	  expect(occupant.x).to be_an(Integer)
	  expect(occupant.y).to be_an(Integer)
	end
      end

      it "should grow a little bit" do
	expect(subject.size).to be > 1
      end

      it "should not grow too much" do
	expect(subject.size).not_to be > subject.limit
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
abstracta-0.1.1 spec/abstracta/developer_spec.rb