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
+7 -5
View File
@@ -1,17 +1,19 @@
# frozen_string_literal: true
require_relative '../ship' # <-- adjust to the actual path of ship.rb
require './ship'
require './player'
RSpec.describe Ship do
let(:ship) { Ship.new(0, 0) }
let(:ship) { Ship.new(0, 0, Player.new('test player 01')) }
describe '#initialize' do
it 'stores the given position' do
expect(ship.instance_variable_get(:@position)).to eq([0, 0])
expect(ship.instance_variable_get(:@position)).to eq [0, 0]
end
it 'sets the speed to 0.1' do
expect(ship.instance_variable_get(:@speed)).to eq(0.1)
expect(ship.instance_variable_get(:@speed)).to eq 0.1
end
it 'does not set @moving until a direction is chosen' do
@@ -70,7 +72,7 @@ RSpec.describe Ship do
}
mapping.each do |dir, expected|
expect { ship.move_direction(dir) }.not_to raise_error
expect(ship.instance_variable_get(:@moving)).to eq(expected)
expect(ship.instance_variable_get(:@moving)).to eq expected
end
end