Ruby on Rails
HowtoPutSerializedColumnsInYamlFixtures (Version #1)

If you need/want to run tests for methods that use serialized attributes then you should brush up a bit about Ruby & YAML.

Keep in mind that rake test_units will serialze the data for you as it puts it in your test database, and write it accordingly. Here is an example record:

<pre> Blog: id: 1 name: Blog queries: recent: cond: "[\"publish=1 AND published_at < ?\",Time.now]" sort: "published_at DESC" draft: cond: "publish=0" sort: "created_at DESC" stale_drafts: cond: "publish=0" sort: "created_at ASC" </pre>

would turn the ‘queries’ column into a hash like so:

<pre> {'recent' => {'cond' => "[\"publish=1 AND published_at < ?\",Time.now]", 'sort' => "published_at DESC" }, 'draft' => { 'cond' => "", 'sort' => "created_at DESC" }, 'stale_drafts' => { 'cond' => "publish=0", 'sort' => "created_at ASC" } } </pre>

If you need/want to run tests for methods that use serialized attributes then you should brush up a bit about Ruby & YAML.

Keep in mind that rake test_units will serialze the data for you as it puts it in your test database, and write it accordingly. Here is an example record:

<pre> Blog: id: 1 name: Blog queries: recent: cond: "[\"publish=1 AND published_at < ?\",Time.now]" sort: "published_at DESC" draft: cond: "publish=0" sort: "created_at DESC" stale_drafts: cond: "publish=0" sort: "created_at ASC" </pre>

would turn the ‘queries’ column into a hash like so:

<pre> {'recent' => {'cond' => "[\"publish=1 AND published_at < ?\",Time.now]", 'sort' => "published_at DESC" }, 'draft' => { 'cond' => "", 'sort' => "created_at DESC" }, 'stale_drafts' => { 'cond' => "publish=0", 'sort' => "created_at ASC" } } </pre>