dawarich/spec/factories/trips.rb
2025-01-24 15:58:44 +01:00

27 lines
637 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :trip do
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 }
distance { 100 }
path { 'LINESTRING(1 1, 2 2, 3 3)' }
trait :with_points do
after(:build) do |trip|
(1..25).map do |i|
create(
:point,
:with_geodata,
:reverse_geocoded,
timestamp: trip.started_at + i.minutes,
user: trip.user
)
end
end
end
end
end