Hi converted two of my models to HABTM today but I am having a real
hard time getting my unit tests to pass now. Specifically, when I
destroy a record I get this error:
...many many lines of this above...
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_callbacks''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/callbacks.rb:321:in
`destroy_witho
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/transactions.rb:122:in
`destroy''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/transactions.rb:122:in
`transactio
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/transactions.rb:91:in
`transaction
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/transactions.rb:118:in
`transactio
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/transactions.rb:122:in
`destroy''
I have a category table an asset table and an assets_categories table
My destroy unit tests looks like this:
def test_destroy
#check to ensure asset belongs to categories
assert_equal false, @intl_image.categories.empty?
@intl_image.categories.clear
#check to ensure the asset now belongs to no categories
assert_equal true, @intl_image.categories.empty?
@intl_image.save
@intl_image.reload
@img = Asset.find(@intl_image.id)
-ftsq1ey501zBNWXE1URa6A@public.gmane.org
assert_raise(ActiveRecord::RecordNotFound){Asset.find(@intl_image.id)}
end
Any help is greatly appreciated.
Thanks,
Mark
--
--------------------------------------------------------------------
I am Mark Daggett and I approve this message.