Correct way to run tests without rake?

Hello! I am trying to make a final major effort to get Rails 100% supported in JRuby, but I'm having some trouble with the tests. There are a number of tests that, when run directly with Ruby, produce errors or failures. I think perhaps I'm doing something wrong. I need to know that the tests run correctly in Ruby to be able to fix JRuby's failures, but so far I haven't gotten that to happen.

Is there a specific way I should be running the tests outside of Rake?

- Charlie

Hi Charles

I think it depends on what you are testing. For instance, for anything under actionpack you can just do "ruby name_of_test.rb" and it should just work. For activerecord, you have to setup the database first in your db of choice, and then include the connection adapter when you run the test:

   cd test; ruby -I "connections/native_mysql" base_test.rb

This is also all documented in the RUNNING_UNIT_TESTS file that is under each of the component's directory.

- Rob

Rob Sanheim wrote:

I think it depends on what you are testing. For instance, for anything under actionpack you can just do "ruby name_of_test.rb" and it should just work. For activerecord, you have to setup the database first in your db of choice, and then include the connection adapter when you run the test:

Ok, I figured as much for ActiveRecord, but I'm getting failures in other tests where I wouldn't expect them for Ruby. The following files have failures or errors when run directly with Ruby 1.8.5 on OS X:

actionpack/test/controller/action_pack_assertions.rb actionpack/test/template/active_record_helper_test.rb actionpack/test/template/tag_helper_test.rb activesupport/test/dependencies_test.rb activesupport/test/inflector_test.rb activesupport/test/time_zone_test.rb activesupport/test/core_ext/class_test.rb activesupport/test/core_ext/exception_test.rb activesupport/test/core_ext/object_and_class_ext_test.rb actionmailer/test/mail_service_test.rb railties/test/dispatcher_test.rb (seems to terminate early) railties/test/plugin_test.rb (seems to want a valid RAILS_ROOT?) railties/test/rails_info_test.rb railties/test/webrick_dispatcher_test.rb (also wants RAILS_ROOT)

I haven't tried actionwebservice or activerecord again since they require DB set up. If there's something I'm doing wrong running the above tests please let me know. JRuby is very close to 100% in actionpack and activesupport, but shares the above failures (plus a couple others). I'm hoping to get everything 100% in the next two weeks.

- Charlie