Why are my unit tests passing?

Most people want to know why their tests are failing. I want to know why they are passing. They really shouldn't be.

The test environment database defined in database.yml does not exist. I have not altered the auto-generated tests at all. When I run the following command from the site root:

ruby test/unit/gender_test.rb

I expect that this should fail. However, I get

"1 tests, 1 assertions, 0 failures, 0 errors"

I'm working my way through the Prag Prog Agile Rails book. In the testing section (page 186), the book says that these tests should fail until I create the testing database. Is the book wrong, or do I have magic unit tests?

RoR Version: 1.2.3 Ruby Version: 1.8.6 DB: Mysql

Thanks for the help.

Ian

Thank you for your reply.

I noticed the simplicity of the default test & have some familiarity with both unit testing and Test::Unit. But the example I'm reading says that even this very simple test should fail if the database doesn't exist. That's where my confusion comes from.

Ian,

I noticed the simplicity of the default test & have some familiarity with both unit testing and Test::Unit. But the example I'm reading says that even this very simple test should fail if the database doesn't exist. That's where my confusion comes from.

Do you have any fixtures declared in your tests? If not, then Rails might not be bothering to connect to the database at all.

Jim