fixtures, how to set a serialized Hash object

I defined in my model : ...   serialize :unavailables ..

which is set like this (Hash : "year" => 2-dimensional Array) {"2008" => Array.new(13).map!{ Array.new(32, 1)} }

In my fixture I need to initiliaze this field with the following hash :

{"2008" => Array.new(4).map!{ Array.new(32, 1)} + Array.new(1).map! { [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] } + Array.new(8).map! { Array.new(32, 1)} }

I tried to write :

<%= Hash.new({"2008" => Array.new(10).map!{ Array.new(32, 1)} + Array.new(1).map!{ [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] } + Array.new(2).map!{ Array.new(32, 1)} }) %> but it gives me a full string : myobject.unavailables "200811111111111111111111111111111111111111111111111..."

I also tried : <%= Hash.new({"2008" => Array.new(10).map!{ Array.new(32, 1)} + Array.new(1).map!{ [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] } + Array.new(2).map!{ Array.new(32, 1)} }).to_yaml %> but it gives me an empty hash : myobject.unavailables {}

any clue ?

thanks

I found a workaround....

I defined a ruby function using irb def unvailable_period(year, month, day_start, day_end)      v = {"#{year}" => (Array.new(month).map!{ Array.new(32, 1)} + Array.new(1).map!{ ( [1] + Array.new(day_end - day_start + 1, -1) + Array.new(32 - day_end - 1,1) ) } + Array.new(12-month).map! { Array.new(32, 1)}) } end

and i used it to ouput a yaml structure v = unvailable_period(2008, 10, 1,15) v.to_yaml => "--- \n\"2008\": \n- - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n - 1\n ... etc then I copied/pasted it into my fixture, but it seems to be only a workaround...

I tried to define the unvailable_period() function into a lib/ unavailable_test_helper.rb , and include in my class Test::Unit::TestCase ( test_helper.rb) but I could not use it from the fixture (error : not found), is there a way to do it ?

writing in my fixture : unavailables: <%= unvailable_period(2008, 10, 1,15).to_yaml %> to get the all structure ?