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