2024-03-23 08:36:09 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
RSpec.describe OwnTracks::ExportParser do
|
|
|
|
|
describe '#call' do
|
2024-03-24 13:05:39 -04:00
|
|
|
subject(:parser) { described_class.new(import.id).call }
|
2024-03-23 08:36:09 -04:00
|
|
|
|
|
|
|
|
let(:file_path) { 'spec/fixtures/owntracks_export.json' }
|
2024-03-24 13:05:39 -04:00
|
|
|
let(:file) { fixture_file_upload(file_path) }
|
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
let(:import) { create(:import, user: user, file: file, name: File.basename(file.path)) }
|
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
|