Uncapitalize type if trying to find translation-string

Signed-off-by: Lukas Matt <lukas@zauberstuhl.de>
This commit is contained in:
Lukas Matt 2015-10-07 08:09:15 +02:00
parent e2d895c636
commit 74fbd122a1
2 changed files with 11 additions and 1 deletions

View file

@ -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)

View file

@ -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