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

**URL:** <https://www.ruby-forum.com/t/can-i-run-erb-instructions-in-a-test-fixture-yml-file/117026>\
**Category:** Rails\
**Created:** [October 12, 2007, 6:52am UTC](https://www.ruby-forum.com/t/can-i-run-erb-instructions-in-a-test-fixture-yml-file/117026 "2007-10-12T06:52:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ranieri\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/43a26b/32.png) [@Ranieri\_T](https://www.ruby-forum.com/u/Ranieri_T)\
**Post date:** [October 12, 2007, 6:52am UTC](https://www.ruby-forum.com/t/can-i-run-erb-instructions-in-a-test-fixture-yml-file/117026/1 "2007-10-12T06:52:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ranieri\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/43a26b/32.png) [@Ranieri\_T](https://www.ruby-forum.com/u/Ranieri_T)\
**Post date:** [October 12, 2007, 10:46am UTC](https://www.ruby-forum.com/t/can-i-run-erb-instructions-in-a-test-fixture-yml-file/117026/2 "2007-10-12T10:46:20Z")

</div>

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
