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.
41cc2c53544016a86472343ab3fdc0ff?d=identicon&s=25 Simon Macneall (Guest)
on 2009-01-07 07: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
41cc2c53544016a86472343ab3fdc0ff?d=identicon&s=25 Simon Macneall (Guest)
on 2009-01-07 08: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 Macneall" <macneall@gmail.com>
To: "rubyonrails-talk@googlegroups.com"
<rubyonrails-talk@googlegroups.com>
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
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-01-07 20: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.