dawarich/spec/jobs/data_migrations/migrate_points_latlon_job_spec.rb

20 lines
594 B
Ruby
Raw Normal View History

2025-02-22 17:14:23 -05:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe DataMigrations::MigratePointsLatlonJob, type: :job do
describe '#perform' do
it 'updates the lonlat column for all tracked points' do
user = create(:user)
point = create(:point, latitude: 2.0, longitude: 1.0, user: user)
2025-09-03 17:27:59 -04:00
# Clear the lonlat to simulate points that need migration
point.update_column(:lonlat, nil)
2025-02-22 17:14:23 -05:00
expect { subject.perform(user.id) }.to change {
point.reload.lonlat
2025-09-03 17:27:59 -04:00
}.from(nil).to(RGeo::Geographic.spherical_factory.point(1.0, 2.0))
2025-02-22 17:14:23 -05:00
end
end
end