2015-09-25 12:07:36 +05:30
|
|
|
require "spec_helper"
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe Gitlab::Email::AttachmentUploader do
|
2015-09-25 12:07:36 +05:30
|
|
|
describe "#execute" do
|
2018-03-27 19:54:05 +05:30
|
|
|
let(:project) { create(:project) }
|
2015-09-25 12:07:36 +05:30
|
|
|
let(:message_raw) { fixture_file("emails/attachment.eml") }
|
|
|
|
let(:message) { Mail::Message.new(message_raw) }
|
|
|
|
|
|
|
|
it "uploads all attachments and returns their links" do
|
|
|
|
links = described_class.new(message).execute(project)
|
|
|
|
link = links.first
|
|
|
|
|
|
|
|
expect(link).not_to be_nil
|
|
|
|
expect(link[:alt]).to eq("bricks")
|
|
|
|
expect(link[:url]).to include("bricks.png")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|