diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-20 22:41:47 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-20 22:41:47 +0300 |
commit | 54b04f1c5b6c486a67c654ee9987e5f5ec4501fd (patch) | |
tree | 6c191226132073546adca92f259d1d17400949ba /spec/lib/gitlab/email | |
parent | ac268674edfdaa5b8232f9875481410fc5112f60 (diff) |
Add fixture_file helper.
Diffstat (limited to 'spec/lib/gitlab/email')
-rw-r--r-- | spec/lib/gitlab/email/attachment_uploader_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/email/receiver_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/email/reply_parser_spec.rb | 6 |
3 files changed, 1 insertions, 19 deletions
diff --git a/spec/lib/gitlab/email/attachment_uploader_spec.rb b/spec/lib/gitlab/email/attachment_uploader_spec.rb index b54ee8aa72a..e8208e15e29 100644 --- a/spec/lib/gitlab/email/attachment_uploader_spec.rb +++ b/spec/lib/gitlab/email/attachment_uploader_spec.rb @@ -1,18 +1,12 @@ require "spec_helper" describe Gitlab::Email::AttachmentUploader do - def fixture_file(filename) - return '' if filename.blank? - file_path = File.expand_path(Rails.root + 'spec/fixtures/' + filename) - File.read(file_path) - end - describe "#execute" do let(:project) { build(:project) } let(:message_raw) { fixture_file("emails/attachment.eml") } let(:message) { Mail::Message.new(message_raw) } - it "creates a post with an attachment" do + it "uploads all attachments and returns their links" do links = described_class.new(message).execute(project) link = links.first diff --git a/spec/lib/gitlab/email/receiver_spec.rb b/spec/lib/gitlab/email/receiver_spec.rb index 3d434aeaf91..a6f682a2711 100644 --- a/spec/lib/gitlab/email/receiver_spec.rb +++ b/spec/lib/gitlab/email/receiver_spec.rb @@ -1,12 +1,6 @@ require "spec_helper" describe Gitlab::Email::Receiver do - def fixture_file(filename) - return '' if filename.blank? - file_path = File.expand_path(Rails.root + 'spec/fixtures/' + filename) - File.read(file_path) - end - before do allow(Gitlab.config.reply_by_email).to receive(:enabled).and_return(true) allow(Gitlab.config.reply_by_email).to receive(:address).and_return("reply+%{reply_key}@appmail.adventuretime.ooo") diff --git a/spec/lib/gitlab/email/reply_parser_spec.rb b/spec/lib/gitlab/email/reply_parser_spec.rb index 32120d56cbc..c552e632ce2 100644 --- a/spec/lib/gitlab/email/reply_parser_spec.rb +++ b/spec/lib/gitlab/email/reply_parser_spec.rb @@ -2,12 +2,6 @@ require "spec_helper" # Inspired in great part by Discourse's Email::Receiver describe Gitlab::Email::ReplyParser do - def fixture_file(filename) - return '' if filename.blank? - file_path = File.expand_path(Rails.root + 'spec/fixtures/' + filename) - File.read(file_path) - end - describe '#execute' do def test_parse_body(mail_string) described_class.new(Mail::Message.new(mail_string)).execute |