Finished testing and docs for now. Time for new features!

This commit is contained in:
2025-10-02 23:58:24 -06:00
parent 279658f3e5
commit b8f54b44a3
16 changed files with 316 additions and 66 deletions
+5 -5
View File
@@ -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