mardi 10 juillet 2018

Embedded Ruby in text fixture

I'm testing the text part of an email in my Rails application and I have a text fixture to test against. The fixture is not a .yml file since it's just text to test against. However, the email contains the current year (like 2010-2018) and I'm trying to see if I can use erb in that text fixture so I can test my email without having to update it every year.

This is how I'm currently using the textfile:

textfile

...
Copyright 2006-2018

test file:

assert_equal read_fixture('textfile').join, email.text_part.body.to_s

Aucun commentaire:

Enregistrer un commentaire