Forum: Ruby on Rails Loading Hash during testing using Fixtures

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Simon M. (Guest)
on 2009-01-07 08:48
(Received via mailing list)
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
Simon M. (Guest)
on 2009-01-07 09:02
(Received via mailing list)
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
Phlip (Guest)
on 2009-01-07 21:45
(Received via mailing list)
> 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.
This topic is locked and can not be replied to.