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 -7
View File
@@ -10,8 +10,8 @@ RSpec.describe Position do
context 'with two arguments' do
it 'stores the coordinates when the sum is even' do
pos = Position.new(*even_pair)
expect(pos.x_pos).to eq(even_pair[0])
expect(pos.y_pos).to eq(even_pair[1])
expect(pos.x_pos).to eq even_pair[0]
expect(pos.y_pos).to eq even_pair[1]
end
it 'raises ArgumentError when the sum is odd' do
@@ -43,30 +43,30 @@ RSpec.describe Position do
describe '#two_d_cartesian' do
it 'returns the original (x, y) pair' do
pos = Position.new(*even_pair)
expect(pos.two_d_cartesian).to eq(even_pair)
expect(pos.two_d_cartesian).to eq even_pair
end
end
describe '#two_d_hexagonal' do
it 'returns an array of nil values for a, b, c' do
pos = Position.new(*even_pair)
expect(pos.two_d_hexagonal).to eq([nil, nil, nil])
expect(pos.two_d_hexagonal).to eq [nil, nil, nil]
end
end
describe '#to_s' do
it 'puts out the coordinates' do
expect(Position.new(*even_pair).to_s).to eq('(4, 6)')
expect(Position.new(*even_pair).to_s).to eq '(4, 6)'
end
end
describe '#==' do
it 'returns false when the positions differ' do
expect(Position.new(*even_pair) == Position.new(6, 8)).to eq(false)
expect(Position.new(*even_pair) == Position.new(6, 8)).to eq false
end
it 'returns true when the positions are the same' do
expect(Position.new(*even_pair) == Position.new(4, 6)).to eq(true)
expect(Position.new(*even_pair) == Position.new(4, 6)).to eq true
end
end
end