Commit 53d7647f282a42c11ebf993e9b933bcc1a6f22c5
Exists in
master
and in
1 other branch
Merge pull request #355 from duritong/fix/352
fix #352 - truncate long messages so subject is truncated
Showing
2 changed files
with
8 additions
and
1 deletions
Show diff stats
app/mailers/mailer.rb
... | ... | @@ -10,7 +10,7 @@ class Mailer < ActionMailer::Base |
10 | 10 | @app = notice.app |
11 | 11 | |
12 | 12 | mail :to => @app.notification_recipients, |
13 | - :subject => "[#{@app.name}][#{@notice.environment_name}] #{@notice.message}" | |
13 | + :subject => "[#{@app.name}][#{@notice.environment_name}] #{@notice.message.truncate(50)}" | |
14 | 14 | end |
15 | 15 | |
16 | 16 | def deploy_notification(deploy) | ... | ... |
spec/mailers/mailer_spec.rb
... | ... | @@ -19,6 +19,13 @@ describe Mailer do |
19 | 19 | it "should have inline css" do |
20 | 20 | email.should have_body_text('<p class="backtrace" style="') |
21 | 21 | end |
22 | + | |
23 | + context 'with a very long message' do | |
24 | + let(:notice) { Fabricate(:notice, :message => 6.times.collect{|a| "0123456789" }.join('')) } | |
25 | + it "should truncate the long message" do | |
26 | + email.subject.should =~ / \d{47}\.{3}$/ | |
27 | + end | |
28 | + end | |
22 | 29 | end |
23 | 30 | end |
24 | 31 | ... | ... |