I’m trying to get the unit testing for a new project to use the
wonderful
:memory: database specification for SQLite. However, like many people
before me, I can’t get the schema to import or have anything else
useful.
Initially, the error I get is:
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/errors.rb:94:in
`check’: cannot rollback - no transaction is active
(SQLite3::SQLException)
Since this error seems to be transaction related, I followed the advice
from
another post, and turned off transactional fixtures. That changed the
error
message to this:
ActiveRecord::StatementInvalid: no such table: repositories: DELETE FROM
repositories WHERE 1=1
Which certainly seems to suggest that no tables have been created in the
memory database.
In an attempt to discover whether what I want to do is actually
possible, I
grepped the source for :memory:. Some of the AR unit tests do appear to
use
an in-memory SQLite database, but they create the tables by hand from a
definition file (ugh).
Is there anyone who actually knows how this is supposed to work in
Rails,
and can provide helpful pointers as to it’s use? If not, may I suggest
removing mention of it from the default database.yml file, to prevent
confusion such as this in the future?
- Matt
–
English is about as pure as a cribhouse whore. We don’t just borrow
words; on occasion, English has pursued other languages down alleyways
to beat them unconscious and rifle their pockets for new vocabulary."
– James D. Nicoll, resident of rec.arts.sf.written