dawarich/spec/jobs/overland/batch_creating_job_spec.rb
2024-05-25 13:26:56 +02:00

22 lines
590 B
Ruby

require 'rails_helper'
RSpec.describe Overland::BatchCreatingJob, type: :job do
describe '#perform' do
subject(:perform) { described_class.new.perform(json, user.id) }
let(:file_path) { 'spec/fixtures/files/overland/geodata.json' }
let(:file) { File.open(file_path) }
let(:json) { JSON.parse(file.read) }
let(:user) { create(:user) }
it 'creates a location' do
expect { perform }.to change { Point.count }.by(1)
end
it 'creates a point with the correct user_id' do
perform
expect(Point.last.user_id).to eq(user.id)
end
end
end