[Nitro] Og fixtures for Time class

Humber Aquino humberaquino at gmail.com
Mon Dec 19 15:45:33 EST 2005


Hi everyone! I'm having a little problem with the fixtures..

model.rb
 class SomeClass
   property :some_time, Time
 end

some_class.yml
something:
  some_time: 2005-12-19 09:00:00 # rails's fixture like


tc_model.rb
class TestModel < Test::Unit::TestCase

  def setup
    @og = Og.setup(
      :destroy => true,
      :store => :mysql,
      :name => 'test_db',
      :user => 'web_user',
      :password => '*******'
    )
    og_fixture SomeClass
  end

  def test_all
    assert_equal Time.utc(2005,12,19,9,0,0) , @something.some_time
  end
end

When i run this test it saids that can't insert an string.. Glue
doesn't parse the time an convert it to a Time object? How can i solve
this?

This is the output of the test:

Loaded suite test/tc_model
Started
Database "test_db" dropped
I, [2005-12-19T21:01:00.278501 #31274]  INFO -- : Database 'test_db' not found!
I, [2005-12-19T21:01:00.342666 #31274]  INFO -- : Created table 'ogsomeclass'.
E
Finished in 0.211703 seconds.

  1) Error:
test_all(TestModel):
NoMethodError: undefined method `strftime' for "2005-12-19 09:00:00":String
    /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/store/sql.rb:24:in `timestamp'
    (eval):5:in `og_insert'
    /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/store.rb:100:in `save'
    /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/entity.rb:14:in `save'
    /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/test/testcase.rb:46:in
`og_fixture'
    /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/test/testcase.rb:45:in
`og_fixture'
    /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/test/testcase.rb:42:in
`og_fixture'
    test/tc_model.rb:18:in `setup'

1 tests, 0 assertions, 0 failures, 1 errors

Please help me :D

Thanks in advance

Humber




More information about the Nitro-general mailing list