Model records are not saved to database in during tests

Hi,

I’m trying to do unit tests which should save informations into a
database that another computer should be able to get while the test
is running.

The problem is although my unit test class has
“use_transactional_fixtures” set to false, when I create a new
instance of a model and save it, it does not actually appear in the
database when connecting to this same database with the “mysql”
command line tool. The fixtures are the only present records.

My question is: how to do so that the records actually get inserted
into the test database ?

Thank you :-).

(Sorry for the careless mistake in the title)

My question is: how to do so that the records actually get inserted
into the test database ?

Unfortunately, this Rails behaviour prevents me from going further in
my project.
Does anybody have an idea ?

On Monday, June 12, 2006, at 6:42 PM, Roman LE NEGRATE wrote:

My question is: how to do so that the records actually get
inserted > into the test database ?

Unfortunately, this Rails behaviour prevents me from going further
in my project.
Does anybody have an idea ?


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

This is normal testing behavior. For each test the database is
populated with your fixtures and then torn down again at the end. This
prevents tests from being dependent on each other.

To get around this behavior you will need to do some hackery in the
Testing code. You may want to define a new ‘environment’ called
‘distributed-test’ and then patch the testing code to skip the database
rollback in that case. Just remember that your tests may behave oddly
since they are no longer independent of each other unless you manually
reload the data.

_Kevin

since they are no longer independent of each other unless you manually
reload the data.

Thank you Kevin.