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-04-02 11:37:38 -04:00
|
|
|
subject(:parser) { described_class.new(import).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
|
|
|
|
|
expect { parser }.to change { Point.count }.by(8)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|