mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
22 lines
634 B
Ruby
22 lines
634 B
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe ImportJob, type: :job do
|
|
describe '#perform' do
|
|
subject(:perform) { described_class.new.perform(user.id, import.id) }
|
|
|
|
let(:file_path) { 'spec/fixtures/owntracks_export.json' }
|
|
let(:file) { fixture_file_upload(file_path) }
|
|
let(:user) { create(:user) }
|
|
let(:import) { create(:import, user: user, file: file, name: File.basename(file.path)) }
|
|
|
|
it 'creates points' do
|
|
expect { perform }.to change { Point.count }.by(8)
|
|
end
|
|
|
|
it 'calls StatCreatingJob' do
|
|
expect(StatCreatingJob).to receive(:perform_later).with(user.id)
|
|
|
|
perform
|
|
end
|
|
end
|
|
end
|