Running Unit Tests With SphinxSE

Several of my unit tests run queries against SphinxSE. Since Rails
creates the test DB by dumping the dev DB schema, my SphinxSE queries
aren’t run against the test DB.

There seems to be no way to hook into the test:clone_structure task,
so I thought that I’ll just have the appropriate unit tests include
this:

module SphinxTest
@@index = ‘ct_test_index’
mattr_accessor :index, :host, :port

self << class
def included(klass)
alter_test_table unless
end

#MySQL specific
def alter_test_table
  return unless ActiveRecord::Base.connection.table_exists?

(Query::TABLE_SPHINX)

  create = ActiveRecord::Base.connection.select_value "show create

table #{Query::TABLE_SPHINX}"
if @@index && md = create.match %r|sphinx://([-.\w]+):(\d+)?/[-
\w]+|
host = @@host || md[0]
port = @@port || md[1]

    alter = %|alter table #{Query::TABLE_SPHINX}

connection=“sphinx://#{host}:#{port}/#{@@index}”|
ActiveRecord::Base.connection.execute alter
end
end
end
end

does anyone know of way to do this from outside my unit tests?

On a side note, assuming portability was an issue, there seems to be
know way to get the TableDefinition from the connection. Is this
really the case?

Thanks