Fix test according to new file format for Owntracks

This commit is contained in:
Eugene Burmakin 2024-10-15 22:41:49 +02:00
parent 11d024127e
commit 786ce722d1
4 changed files with 10 additions and 10 deletions

View file

@ -4,7 +4,7 @@ class OwnTracks::RecParser
attr_reader :file
def initialize(file)
@file = file.read
@file = file
end
def call

View file

@ -41,7 +41,7 @@ RSpec.describe 'Imports', type: :request do
before { sign_in user }
context 'when importing owntracks data' do
let(:file) { fixture_file_upload('owntracks/2024-03.rec', 'application/json') }
let(:file) { fixture_file_upload('owntracks/2024-03.rec', 'text/plain') }
it 'queues import job' do
expect do

View file

@ -7,7 +7,7 @@ RSpec.describe OwnTracks::Params do
subject(:params) { described_class.new(raw_point_params).call }
let(:file_path) { 'spec/fixtures/files/owntracks/2024-03.rec' }
let(:file) { File.open(file_path) }
let(:file) { File.read(file_path) }
let(:json) { OwnTracks::RecParser.new(file).call }
let(:raw_point_params) { json.first }

View file

@ -24,7 +24,7 @@ describe 'OwnTracks Points API', type: :request do
't': 'p',
'conn': 'w',
'm': 1,
'tst': 1706965203,
'tst': 1_706_965_203,
'alt': 41,
'_type': 'location',
'tid': 'RO',
@ -70,9 +70,9 @@ describe 'OwnTracks Points API', type: :request do
response '200', 'Point created' do
let(:file_path) { 'spec/fixtures/files/owntracks/2024-03.rec' }
let(:file) { File.open(file_path) }
let(:json) { JSON.parse(file.read) }
let(:point) { json['test']['iphone-12-pro'].first }
let(:file) { File.read(file_path) }
let(:json) { OwnTracks::RecParser.new(file).call }
let(:point) { json.first }
let(:api_key) { create(:user).api_key }
run_test!
@ -80,9 +80,9 @@ describe 'OwnTracks Points API', type: :request do
response '401', 'Unauthorized' do
let(:file_path) { 'spec/fixtures/files/owntracks/2024-03.rec' }
let(:file) { File.open(file_path) }
let(:json) { JSON.parse(file.read) }
let(:point) { json['test']['iphone-12-pro'].first }
let(:file) { File.read(file_path) }
let(:json) { OwnTracks::RecParser.new(file).call }
let(:point) { json.first }
let(:api_key) { nil }
run_test!