Fix failed tests

This commit is contained in:
Eugene Burmakin 2025-01-20 20:41:26 +01:00
parent 620579d162
commit a311325c82
2 changed files with 6 additions and 14 deletions

View file

@ -9,19 +9,9 @@ class Points::CreateJob < ApplicationJob
data.each_slice(1000) do |location_batch|
Point.upsert_all(
location_batch,
unique_by: %i[latitude longitude timestamp user_id]
unique_by: %i[latitude longitude timestamp user_id],
returning: false
)
end
end
private
def point_exists?(params, user_id)
Point.exists?(
latitude: params[:latitude],
longitude: params[:longitude],
timestamp: params[:timestamp],
user_id:
)
end
end

View file

@ -4,6 +4,7 @@ require 'rails_helper'
RSpec.describe Points::Params do
describe '#call' do
let(:user) { create(:user) }
let(:file_path) { 'spec/fixtures/files/points/geojson_example.json' }
let(:file) { File.open(file_path) }
let(:json) { JSON.parse(file.read) }
@ -40,11 +41,12 @@ RSpec.describe Points::Params do
timestamp: '2025-01-17T21:03:01Z',
device_id: '8D5D4197-245B-4619-A88B-2049100ADE46'
}
}.with_indifferent_access
}.with_indifferent_access,
user_id: user.id
}
end
subject(:params) { described_class.new(json).call }
subject(:params) { described_class.new(json, user.id).call }
it 'returns an array of points' do
expect(params).to be_an(Array)