Remove unused point creation jobs

This commit is contained in:
Eugene Burmakin 2026-01-11 12:03:08 +01:00
parent 620fbba67c
commit 379a5d6f1c
5 changed files with 1 additions and 91 deletions

View file

@ -1,9 +0,0 @@
# frozen_string_literal: true
class Overland::BatchCreatingJob < ApplicationJob
queue_as :points
def perform(params, user_id)
Overland::PointsCreator.new(params, user_id).call
end
end

View file

@ -1,9 +0,0 @@
# frozen_string_literal: true
class Owntracks::PointCreatingJob < ApplicationJob
queue_as :points
def perform(point_params, user_id)
OwnTracks::PointCreator.new(point_params, user_id).call
end
end

View file

@ -1,32 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Overland::BatchCreatingJob, type: :job do
describe '#perform' do
subject(:perform) { described_class.new.perform(json, user.id) }
let(:file_path) { 'spec/fixtures/files/overland/geodata.json' }
let(:file) { File.open(file_path) }
let(:json) { JSON.parse(file.read) }
let(:user) { create(:user) }
it 'creates a location' do
expect { perform }.to change { Point.count }.by(1)
end
it 'creates a point with the correct user_id' do
perform
expect(Point.last.user_id).to eq(user.id)
end
context 'when point already exists' do
it 'does not create a point' do
perform
expect { perform }.not_to(change { Point.count })
end
end
end
end

View file

@ -1,40 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Owntracks::PointCreatingJob, type: :job do
describe '#perform' do
subject(:perform) { described_class.new.perform(point_params, user.id) }
let(:point_params) do
{ lat: 1.0, lon: 1.0, tid: 'test', tst: Time.now.to_i, topic: 'iPhone 12 pro' }
end
let(:user) { create(:user) }
it 'creates a point' do
expect { perform }.to change { Point.count }.by(1)
end
it 'creates a point with the correct user_id' do
perform
expect(Point.last.user_id).to eq(user.id)
end
context 'when point already exists' do
it 'does not create a point' do
perform
expect { perform }.not_to(change { Point.count })
end
end
context 'when point is invalid' do
let(:point_params) { { lat: 1.0, lon: 1.0, tid: 'test', tst: nil, topic: 'iPhone 12 pro' } }
it 'does not create a point' do
expect { perform }.not_to(change { Point.count })
end
end
end
end

View file

@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Api::V1::OwnTracks::Points', type: :request do
RSpec.describe 'Api::V1::Owntracks::Points', type: :request do
describe 'POST /api/v1/owntracks/points' do
let(:file_path) { 'spec/fixtures/files/owntracks/2024-03.rec' }
let(:json) { OwnTracks::RecParser.new(File.read(file_path)).call }