# Loading Hash during testing using Fixtures

**URL:** <https://www.ruby-forum.com/t/loading-hash-during-testing-using-fixtures/157079>\
**Category:** Rails\
**Created:** [January 7, 2009, 7:48am UTC](https://www.ruby-forum.com/t/loading-hash-during-testing-using-fixtures/157079 "2009-01-07T07:48:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijomo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/87869e/32.png) [@sijomo](https://www.ruby-forum.com/u/sijomo)\
**Post date:** [January 7, 2009, 7:48am UTC](https://www.ruby-forum.com/t/loading-hash-during-testing-using-fixtures/157079/1 "2009-01-07T07:48:05Z")

</div>

Hi all,

I am finally starting to use the testing framework that rails provides,  
however I have come across a problem that I can’t work out.

Our model has a serialized hash as one of the members, and I can’t work  
out the syntax in the YML file to populate the hash during testing.

Any suggestions?

Cheers  
Simon

---

<div class="post-metadata">

**Author:** ![sijomo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/87869e/32.png) [@sijomo](https://www.ruby-forum.com/u/sijomo)\
**Post date:** [January 7, 2009, 8:02am UTC](https://www.ruby-forum.com/t/loading-hash-during-testing-using-fixtures/157079/2 "2009-01-07T08:02:07Z")

</div>

Never mind

After stepping back and actually thinking about what I was trying to  
achieve, I worked it out.

For those of you following at home from a google search, here is how to  
do  
it.

one:  
id: 1  
options: {name1: value1, name2: value2}

Cheers  
Simon

------- Forwarded message -------  
From: “Simon M.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: “removed\_email\_address@domain.invalid”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Cc:  
Subject: Loading Hash during testing using Fixtures  
Date: Wed, 07 Jan 2009 15:46:57 +0900

Hi all,

I am finally starting to use the testing framework that rails provides,  
however I have come across a problem that I can’t work out.

Our model has a serialized hash as one of the members, and I can’t work  
out the syntax in the YML file to populate the hash during testing.

Any suggestions?

Cheers  
Simon

---

<div class="post-metadata">

**Author:** ![sijomo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/87869e/32.png) [@sijomo](https://www.ruby-forum.com/u/sijomo)\
**Post date:** [January 7, 2009, 8:45pm UTC](https://www.ruby-forum.com/t/loading-hash-during-testing-using-fixtures/157079/3 "2009-01-07T20:45:04Z")

</div>

> one:  
> id: 1  
> options: {name1: value1, name2: value2}

This might be cleaner:

one:  
options:  
name1: value1  
name2: value2

And note you don’t need the id: 1 no more.
