blob: 6486d284ee36e5479b59c189c9d233eac45f4427 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
require "rails_helper"
describe EmailProcessor do
subject { EmailProcessor.new(email) }
let(:email) { build(:email, :with_attachment) }
context "with a csv attachment" do
let(:backup_file) { double(process_later: true) }
let(:user) { create(:user) }
before :each do
email.to.first[:token] = user.id
email.from[:email] = user.email
end
it "imports the csv attachment" do
allow(BackupFile).to receive(:new).
with(user, email.attachments.first).
and_return(backup_file)
subject.process
expect(backup_file).to have_received(:process_later).
with(Program.stronglifts)
end
end
end
|