Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Ruby by Morali ( 13 years ago )
require 'spec_helper'

describe Round do
    Round.create(:number => 1, :move => true)
    rebel = Factory :squad
    empire = Factory :squad

  context 'beginning a new round' do
    before(:each) do
      #empire.destroy # stinking empire!
      rebel.planets.clear
      rebel.facility_fleets.clear
      Factory :fighter, :price => 100
      Factory :facility
      Factory :light_transport, :price => 100
      Factory :warrior, :price => 50
      Factory :warrior, :price => 40
      Factory :capital_ship, :price => 500
      Factory :trooper, :price => 2
      15.times {Factory.create :planet}
      Round.getInstance.new_game!
    end

    it 'should get a random planet for the squad' do
      rebel.planets(true).should_not be_empty
    end
    it 'should create 2 wormholes' do
      wormholes = Planet.where(:wormhole => true).all
      wormholes.count.should == 4
    end
    it 'should place a facility on the new planet' do
      rebel.facility_fleets(true).should_not be_empty
    end
    it 'should place random units on the planets' do
      rebel.generic_fleets.count.should == 23
    end

    it 'should set squad ready' do
      rebel.ready!
      rebel.ready.should be_true
    end
    it 'should go to attack phase when all squads ready' do
      rebel.ready!
      Round.last.move.should be_true
      Round.last.attack.should be_nil
      # quando dou ready no empire nao muda o estado round no teste mas na pratica muda
    end
    it 'should reset state of squads' do
    end
  end
end

 

Revise this Paste

Your Name: Code Language: