[Nitro] Kirby unit test "already has index record" error

Peter Abrahamsen rainhead at gmail.com
Fri Dec 2 05:22:12 EST 2005


Hi all,

I'm learning to program by writing unit tests first. After a few  
stumbling blocks, I got it to work. Now, however, running the test  
throws a RuntimeError. I really can't find what I've changed since it  
was working. I'm using KirbyBase, and destruction is enabled.

Below is the error and stack trace, followed by the test case. Any  
light would be greatly appreciated.

Cheers, P

 >>>
Loaded suite test/tc_model
Started
./usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/store/sql.rb:302:  
warning: already initialized constant OGTABLE
E
Finished in 0.233755 seconds.

   1) Error:
test_insertion(TestModel):
RuntimeError: Table already has index record for recno: 1
     /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/vendor/kirbybase.rb: 
2670:in `add_index_rec'
     /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/vendor/kirbybase.rb: 
529:in `add_to_indexes'
     /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/vendor/kirbybase.rb: 
895:in `insert_record'
     /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/vendor/kirbybase.rb: 
1218:in `with_write_locked_table'
     /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/vendor/kirbybase.rb: 
882:in `insert_record'
     /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/vendor/kirbybase.rb: 
1631:in `insert'
     (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:15:in `setup'
<<<

 >>> test/tc_model.rb
require 'test/unit'

require 'glue/fixture'
require 'og/test'

require 'src/model'

class TestModel < Test::Unit::TestCase

   def setup
     @og = Og.setup(
                    :destroy => true,
                    :store => :kirby
                   )
     og_fixture Event
   end

   def test_all
     test_insertion
   end

   def test_insertion
     assert_equal 'Event Zero', @simple.title
     assert_equal 'The First Event', @simple.desc
     # Is this subject to locale changes?
     assert_equal Date.new(2005,12,24), @simple.date
   end

end
<<<
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2410 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20051202/4688be31/attachment.bin 


More information about the Nitro-general mailing list