How to unit test Rails itself (API)?

Hello,

I searched unit test for Rails on internet, but all the results are for testing Rails APPLICATION generated by Rails.

But I think Rails itself needs unit test, too. I need to make sure that all APIs/methods of Rails work fine in different scenarios.

I didn't see any unit test files in the Rails package. Does anyone know how to unit test Rails itself?

Thanks a lot.

I don't know where you've got your rails from but each of the rails bits has a test folder with a bunch of unit tests.

Fred

My rails is version 1.2.6. There does be a "test" directory, but all subdirectories in it are empty.

My rails is version 1.2.6. There does be a "test" directory, but all subdirectories in it are empty.

Which directory exactly are you talking about? Rails has always had
pretty good test coverage.

Fred

If you have frozen rails in your project then the many rails tests will be distributed in various directories like

vendor     rails         actionmailer             test         actionpack              test         activerecord              test        ...

And actionpack (which contains ActionController and ActionView) and activerecord also have readme files called RUNNING_UNIT_TESTS with instructions on how to run those tests.

If you are using rails from gems they will be in the individual gems.

But normally you don't run these tests in projects, they are really for testing when rails itself is modified/patched, and the tests are run by patch developers and the rails committers before changes are accepted.

Bear in mind that some of the rails tests require their own databases to be set up, which is covered in those RUNNING_UNIT_TESTS readmes.

Hi Rick,

Thank you very much for your reply.

So do you mean that I just need not to test Rails itself, but the prerequisites of Rails, like active*, if the Rails package I got is a frozen version? Or need I get a develop trunk of Rails to get the unit test files?

Thanks a lot.