summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-12-11 13:33:27 +0100
committerRémy Coutable <remy@rymai.me>2018-12-11 15:13:42 +0100
commit24f9fa11a317f04e75b63e241d0ceeb75fdd38a8 (patch)
tree4b411cd9fc03c7315e4aaaea4a2babde578f1a26 /spec/support
parentb388111f6ed5181c357f5c37277f16c6ae234f5a (diff)
downloadgitlab-ce-24f9fa11a317f04e75b63e241d0ceeb75fdd38a8.tar.gz
Fix a potential frozen string error in app/mailers/notify.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/email_helpers.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/helpers/email_helpers.rb b/spec/support/helpers/email_helpers.rb
index 1fb8252459f..ad6e1064499 100644
--- a/spec/support/helpers/email_helpers.rb
+++ b/spec/support/helpers/email_helpers.rb
@@ -34,4 +34,13 @@ module EmailHelpers
def find_email_for(user)
ActionMailer::Base.deliveries.find { |d| d.to.include?(user.notification_email) }
end
+
+ def have_referable_subject(referable, include_project: true, reply: false)
+ prefix = (include_project && referable.project ? "#{referable.project.name} | " : '').freeze
+ prefix = "Re: #{prefix}" if reply
+
+ suffix = "#{referable.title} (#{referable.to_reference})"
+
+ have_subject [prefix, suffix].compact.join
+ end
end