require 'spec_helper' describe GeometricPoint do describe '#initialize_by_numbers' do point = GeometricPoint.new(1, 2) it 'to be equal' do expect(point.x).to eq(1) expect(point.y).to eq(2) end it 'to be not equal' do expect(point.x).not_to eq(3) expect(point.y).not_to eq(3) end end describe '#initialize_by_array' do point = GeometricPoint.new_by_array([1, 2]) it 'to be equal' do expect(point.x).to eq(1) expect(point.y).to eq(2) end it 'to be not equal' do expect(point.x).not_to eq(3) expect(point.y).not_to eq(3) end end describe '#advance_by' do it 'to be the addition of a point to a vector' do point = GeometricPoint.new(1, 2) vector = GeometricVector.new(2, -1) expect(point.advance_by(vector)).to eq(GeometricPoint.new(3, 1)) end end describe '#to_vector' do it 'to be converted to a vector' do expect(GeometricPoint.new(1, 2).to_vector).to eq(GeometricVector.new(1, 2)) end end describe '#==' do it 'to be converted to a vector' do point = GeometricPoint.new(1, 2) expect(point == point).to eq(true) expect(point == GeometricPoint.new(1, 3)).to eq(false) end end end