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.

On 20 Mar 2008, at 10:21, liuxlsh wrote:

know how to unit test Rails itself?

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.

On Mar 20, 6:22 pm, Frederick C. [email protected]

On 20 Mar 2008, at 10:31, liuxlsh wrote:

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

On 3/20/08, liuxlsh [email protected] wrote:

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

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.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

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.

On Mar 20, 7:30 pm, “Rick DeNatale” [email protected] wrote:

vendor
activerecord also have readme files called RUNNING_UNIT_TESTS with
to be set up, which is covered in those RUNNING_UNIT_TESTS readmes.


Rick DeNatale

My
blog on Rubyhttp://talklikeaduck.denhaven2.com/