Forum: Ruby on Rails How to test a mailer that has a date with accents?

Ef8e27e76850a35bbf6738785b7f207b?d=identicon&s=25 David M (Guest)
on 2012-07-19 14:29
(Received via mailing list)
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.

1) 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)
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.