2024-04-25 16:28:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-03-23 08:36:09 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
RSpec.describe OwnTracks::ExportParser do
|
|
|
|
|
describe '#call' do
|
2024-05-25 07:36:15 -04:00
|
|
|
subject(:parser) { described_class.new(import, user.id).call }
|
2024-03-23 08:36:09 -04:00
|
|
|
|
2024-03-24 13:05:39 -04:00
|
|
|
let(:user) { create(:user) }
|
2024-04-25 16:28:34 -04:00
|
|
|
let(:import) { create(:import, user:, name: 'owntracks_export.json') }
|
2024-03-23 08:36:09 -04:00
|
|
|
|
|
|
|
|
context 'when file exists' do
|
|
|
|
|
it 'creates points' do
|
2024-06-30 11:47:36 -04:00
|
|
|
expect { parser }.to change { Point.count }.by(9)
|
2024-03-23 08:36:09 -04:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|