Finished testing and docs for now. Time for new features!
This commit is contained in:
@@ -13,15 +13,15 @@ RSpec.describe Planet do
|
||||
|
||||
describe '#initialize' do
|
||||
it 'stores the random off' do
|
||||
expect(planet.instance_variable_get(:@random)).to eq(random)
|
||||
expect(planet.instance_variable_get(:@random)).to eq random
|
||||
end
|
||||
|
||||
it 'creates a production rate' do
|
||||
expect(planet.instance_variable_get(:@prod_rate)).to eq(Random.new(seed).rand)
|
||||
expect(planet.instance_variable_get(:@prod_rate)).to eq Random.new(seed).rand
|
||||
end
|
||||
|
||||
it 'sets a resource' do
|
||||
expect(planet.instance_variable_get(:@resource)).to eq(PLANET_PRODUCTION_RESOURCES[(Random.new(seed).rand * PLANET_PRODUCTION_RESOURCES.length).floor])
|
||||
expect(planet.instance_variable_get(:@resource)).to eq PLANET_PRODUCTION_RESOURCES[(Random.new(seed).rand * PLANET_PRODUCTION_RESOURCES.length).floor]
|
||||
end
|
||||
|
||||
it 'has a nil owner' do
|
||||
@@ -31,13 +31,13 @@ RSpec.describe Planet do
|
||||
|
||||
describe '#change_owner' do
|
||||
it 'allows an ownership change when the current owner is nil' do
|
||||
expect(planet.change_owner(player_1)).to eq(true)
|
||||
expect(planet.change_owner(player_1)).to eq true
|
||||
expect(planet.instance_variable_get(:@owner)).to eq player_1
|
||||
end
|
||||
|
||||
it 'does not change when already owned' do
|
||||
planet.change_owner(player_2)
|
||||
expect(planet.change_owner(player_1)).to eq(false)
|
||||
expect(planet.change_owner(player_1)).to eq false
|
||||
expect(planet.instance_variable_get(:@owner)).to eq player_2
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user