Loading Hash during testing using Fixtures


#1

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


#2

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
To: “removed_email_address@domain.invalid”
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


#3

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.