JRuby and tests

Using JRuby / ActiveRecord-JDBC / PostgreSQL 8.1 I get

jruby --command rake test (in /Users/stevel/Publisher) rake aborted! Task not supported by 'jdbc'

Is it really the case that testing is not yet supported by ActiveRecord-JDBC or am I missing something obvious?

Actually, yeah, what you are seeing is the artifact of the big hack that is db:test:clone_structure.

If you are using migrations, you can use them to create your test database instead, and that will likely work much better with AR-JDBC. Put the following snippet in a "jdbc.rake" file in your lib/tasks directory and away you go. Let me know if this works for you.

See also http://www.nabble.com/forum/ViewPost.jtp?post=9474383&framed=y for more background.

/Nick --- begin rake snippet ## Build the test database using migrations rather than dumping the schema and loading fixtures

# Here we clear out prereqs and actions for the db:test:prepare task so that it can be redefined Rake::Task["db:test:prepare"].send :instance_variable_set, "@prerequisites", FileList Rake::Task["db:test:prepare"].send :instance_variable_set, "@actions",

namespace :db do namespace :test do    task :prepare => %w(environment db:test:migrate_schema)

   desc 'Use the migrations to create the test database'    task :migrate_schema => 'db:test:purge' do |t|      ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])      ActiveRecord::Schema.verbose = t.application.options.trace      ActiveRecord::Migrator.migrate("db/migrate/")    end end end --- end rake snippet