Merge pull request #6464 from Zauberstuhl/fix_report_translation

Uncapitalize type if trying to find translation-string
This commit is contained in:
Jonne Haß 2015-10-07 17:52:10 +02:00
commit 8c5534a850
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