Skip to content

Commit

Permalink
Fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Freika committed Jan 20, 2025
1 parent 620579d commit a311325
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
14 changes: 2 additions & 12 deletions app/jobs/points/create_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@ def perform(params, user_id)
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
6 changes: 4 additions & 2 deletions spec/services/points/params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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) }
Expand Down Expand Up @@ -40,11 +41,12 @@
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)
Expand Down

0 comments on commit a311325

Please sign in to comment.