dawarich/spec/services/own_tracks/export_parser_spec.rb

25 lines
606 B
Ruby
Raw Normal View History

2024-03-23 08:36:09 -04:00
require 'rails_helper'
RSpec.describe OwnTracks::ExportParser do
describe '#call' do
subject(:parser) { described_class.new(file_path, import_id).call }
let(:file_path) { 'spec/fixtures/owntracks_export.json' }
let(:import_id) { nil }
context 'when file exists' do
it 'creates points' do
expect { parser }.to change { Point.count }.by(8)
end
end
context 'when file does not exist' do
let(:file_path) { 'spec/fixtures/not_found.json' }
it 'raises error' do
expect { parser }.to raise_error('File not found')
end
end
end
end