master
 1require 'rails_helper'
 2
 3RSpec.describe ProcessPhotoJob, :type => :job do
 4  subject { ProcessPhotoJob.new }
 5
 6  describe "#perform" do
 7    let(:blob_storage) { double(upload: true) }
 8    let(:image_path) { File.join(Rails.root, 'spec/fixtures/images/gps.jpg') }
 9    let(:photo) { double(upload: true, save!: true) }
10
11    before :each do
12      allow(subject).to receive(:storage).and_return(blob_storage)
13    end
14
15    it "saves the uploaded image" do
16      subject.perform(photo, image_path)
17      expect(photo).to have_received(:upload).with(image_path, blob_storage)
18      expect(photo).to have_received(:save!)
19    end
20  end
21end