From 74fbd122a12a7db99b77e7f21ff9293597866a79 Mon Sep 17 00:00:00 2001 From: Lukas Matt Date: Wed, 7 Oct 2015 08:09:15 +0200 Subject: [PATCH] Uncapitalize type if trying to find translation-string Signed-off-by: Lukas Matt --- app/mailers/report_mailer.rb | 2 +- spec/mailers/report_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/mailers/report_mailer.rb b/app/mailers/report_mailer.rb index 35aafcf3e..a89468b8b 100644 --- a/app/mailers/report_mailer.rb +++ b/app/mailers/report_mailer.rb @@ -8,7 +8,7 @@ class ReportMailer < ActionMailer::Base def new_report(type, id, role) resource = { url: report_index_url, - type: I18n.t("notifier.report_email.type." + type), + type: I18n.t("notifier.report_email.type.#{type.downcase}"), id: id } person = Person.find(role.person_id) diff --git a/spec/mailers/report_spec.rb b/spec/mailers/report_spec.rb index 32c2afdb1..04869e5d6 100644 --- a/spec/mailers/report_spec.rb +++ b/spec/mailers/report_spec.rb @@ -37,5 +37,15 @@ describe Report, type: :mailer do expect(ActionMailer::Base.deliveries[0].subject).to match("Ein neuer post wurde als anstößig markiert") expect(ActionMailer::Base.deliveries[1].subject).to match("A new post was marked as offensive") end + + it "should find correct post translation" do + ReportMailer.new_report("PosT", 666).each(&:deliver_now) + expect(ActionMailer::Base.deliveries[0].subject).not_to match("translation missing") + end + + it "should find correct comment translation" do + ReportMailer.new_report("CoMMenT", 666).each(&:deliver_now) + expect(ActionMailer::Base.deliveries[0].subject).not_to match("translation missing") + end end end