attachment_uploader_spec.rb 581 Bytes
Newer Older
1 2 3 4 5 6 7 8
require "spec_helper"

describe Gitlab::Email::AttachmentUploader do
  describe "#execute" do
    let(:project) { build(:project) }
    let(:message_raw) { fixture_file("emails/attachment.eml") }
    let(:message) { Mail::Message.new(message_raw) }

Douwe Maan's avatar
Douwe Maan committed
9
    it "uploads all attachments and returns their links" do
10 11 12 13 14 15 16 17 18 19
      links = described_class.new(message).execute(project)
      link = links.first

      expect(link).not_to be_nil
      expect(link[:is_image]).to be_truthy
      expect(link[:alt]).to eq("bricks")
      expect(link[:url]).to include("bricks.png")
    end
  end
end