Behaviour on ActiveRecord in unit-tests

Hello,

sadly I've some trouble understanding the behaviour of AR in a unit test, in
which an object is destroyed, but not destroyed within the database

Test is here:
http://pastie.caboo.se/133741

The background is easy to explain:
We've contacts and contact_combies within our application.
A contact is a human contact (business contact, etc.), a contact_combi
represent a relationship between contacts (usually two, but can be more).
Thus a contact has many contact_combies, and a contact_combi has many
contacts. (classic habtm-relation). contact_combies are edited embedded
within the contact-form (as explained in railscasts.com episodes 73-75)

contact model is here
http://pastie.caboo.se/133746

contact_combi model here:
http://pastie.caboo.se/133745

test log is here
http://pastie.caboo.se/133740

Side note: all models include a simple helper setting some basic-meta-data:
http://pastie.caboo.se/133744

Btw. test is run with:
use_transactional_fixtures = false
, but setting it to true doesn't solve the issue.

I observed:
- Within the application (using it by browser) (dev-env), the code works.
- The assertion in line 20 fails: two objects exist, one is expected
http://pastie.caboo.se/133737
- Deleting the combi is "tried", since the contact_combi's before_detroy
callback is called (see test log)
- No delete is executed in the database
- Its getting quite absurd, if I execute a second contact.save in my test
(enable line 21 - see test)

test_save_delete_multiple_contact_combies(ContactTest):
TypeError: can't modify frozen hash
/var/lib/gems/1.8/gems/activerecord-1.15.6/lib/active_record/base.rb:1978:in
`[]='
/var/lib/gems/1.8/gems/activerecord-1.15.6/lib/active_record/base.rb:1978:in
`write_attribute'
/var/lib/gems/1.8/gems/activerecord-1.15.6/lib/active_record/attribute_methods.rb:67:in
`attribute='
/var/lib/gems/1.8/gems/activerecord-1.15.6/lib/active_record/base.rb:1858:in
`__send__'
/var/lib/gems/1.8/gems/activerecord-1.15.6/lib/active_record/base.rb:1858:in
`method_missing'
/home/jan/aptana-workspace-svn/contacts/app/helpers/save_mixin_helper.rb:3:in
`before_create'
...

This implies:
- destroy is exectued on the contact_combi object and the hash is frozen by
active record.
- But why doesn't these changes appear in the database - is there anything I
can do to make 'em appear?

Thanks,
Happy 2008!
Keep smilöing
yanosz