Can I run ERb instructions in a test fixture YML file?

I think that fixtures file must contains raw (final value) data. By
using a file from the ebook “Build Your Own Ruby on Rails Web
Applications” by Patrick Lenz, I’ve trying to run the line
“created_at: <% Time.now.to_s(:db) %>” from the file ‘votes.yml’. But,
the functional tests has reported a error, showing that the object
created_at, don’t was created at a rjs template. When I’ve added a new
line to “created_at: 2007-10-09 22:49:19”, the tests were finished
with no errors.
So, the question: Can I run ERb instructions in a test fixture YML
file?
Thanks,
Ranieri T.

On 12 Oct 2007, at 05:52, Ranieri T. wrote:

I’ve trying to run the line
“created_at: <% Time.now.to_s(:db) %>” from the file ‘votes.yml’. But,
the functional tests has reported a error, showing that the object
created_at, don’t was created at a rjs template. When I’ve added a new
line to “created_at: 2007-10-09 22:49:19”, the tests were finished
with no errors.
So, the question: Can I run ERb instructions in a test fixture YML
file?

Yes you can but you need an erb output block, i.e. <%= … %> and not
<% … %>

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs