In my mailer I have a date with Spanish format:
sbado, 21 de julio del 2012
I have a custom formatter for that configured in my
config/locales/es.yml
my_date_format: ! ‘%A, %-d de %B del %Y, %k:%M’
I’m trying to test it this way:
test “date with accent” do
mail = MyMailer.my_template
assert_match I18n.l(@object.date, format: :my_date_format),
mail.body.encoded
end
But it fails:
Running tests:
F
Finished tests in 0.438078s, 2.2827 tests/s, 15.9789 assertions/s.
- Failure: test_date_with_accent(MyMailerTest)
[test/unit/mailers/my_mailer_test.rb:12]: Expected /sbado,\ 21\ de\
julio
del\ 2012,\ 14:10/ to match “… …s=C3=A1bado, 21 de julio del
2012, 14:10\r\n …”.
(I have omitted the rest of the email content)