2024-11-28 11:13:04 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-11-27 14:14:17 -05:00
|
|
|
FactoryBot.define do
|
|
|
|
|
factory :trip do
|
2024-11-28 11:13:04 -05:00
|
|
|
user
|
|
|
|
|
name { FFaker::Lorem.word }
|
|
|
|
|
started_at { DateTime.new(2024, 11, 27, 17, 16, 21) }
|
|
|
|
|
ended_at { DateTime.new(2024, 11, 29, 17, 16, 21) }
|
|
|
|
|
notes { FFaker::Lorem.sentence }
|
2025-01-24 09:58:44 -05:00
|
|
|
distance { 100 }
|
|
|
|
|
path { 'LINESTRING(1 1, 2 2, 3 3)' }
|
2024-11-28 11:13:04 -05:00
|
|
|
|
|
|
|
|
trait :with_points do
|
|
|
|
|
after(:build) do |trip|
|
2025-01-20 11:59:13 -05:00
|
|
|
(1..25).map do |i|
|
|
|
|
|
create(
|
|
|
|
|
:point,
|
|
|
|
|
:with_geodata,
|
|
|
|
|
:reverse_geocoded,
|
|
|
|
|
timestamp: trip.started_at + i.minutes,
|
|
|
|
|
user: trip.user
|
|
|
|
|
)
|
|
|
|
|
end
|
2024-11-28 11:13:04 -05:00
|
|
|
end
|
|
|
|
|
end
|
2024-11-27 14:14:17 -05:00
|
|
|
end
|
|
|
|
|
end
|