2024-03-24 13:05:39 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
RSpec.describe ImportJob, type: :job do
|
2024-04-02 11:37:38 -04:00
|
|
|
describe '#perform' do
|
|
|
|
|
subject(:perform) { described_class.new.perform(user.id, import.id) }
|
|
|
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
2024-04-25 16:40:51 -04:00
|
|
|
let(:import) { create(:import, user:, name: 'owntracks_export.json') }
|
2024-04-02 11:37:38 -04:00
|
|
|
|
|
|
|
|
it 'creates points' do
|
|
|
|
|
expect { perform }.to change { Point.count }.by(8)
|
|
|
|
|
end
|
2024-04-02 17:26:26 -04:00
|
|
|
|
|
|
|
|
it 'calls StatCreatingJob' do
|
|
|
|
|
expect(StatCreatingJob).to receive(:perform_later).with(user.id)
|
|
|
|
|
|
|
|
|
|
perform
|
|
|
|
|
end
|
2024-04-02 11:37:38 -04:00
|
|
|
end
|
2024-03-24 13:05:39 -04:00
|
|
|
end
|