ORM and various strategies

88 views
Skip to first unread message

Ashley

unread,
Mar 23, 2012, 7:38:15 PM3/23/12
to database_cleaner
Caveat: My first go round with DatabaseCleaner, in fact fair new to
BDD using Cucumber in general.
It appears the Mongo_Mapperonly has support for the truncation
strategy.

Our Rails Model uses MongoMapper, and our app in general is a Rails
Server with a Coffee-Script component that push javascript to a
browser extension.

Currently I'm having that terrible unsolved error:
ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished)
driven by: ../cucumber-rails-1.3.0/lib/cucumber/rails/hooks/
database_cleaner.rb:9:in `After'

I'm sure it's because DatabaseCleaner is trying to execute it's
strategy via ActiveRecord ORM, even though I've specified mongomapper
as the strategy. I'd be fine with just using truncation, but we need
transaction in other locations (the web client side / selenium driven
test).

I guess my question is: Why is there no transaction strategy support
for MongoMapper, and if it needs developing, where would I start?

Ben Mabey

unread,
Mar 23, 2012, 10:24:22 PM3/23/12
to database...@googlegroups.com
MongoDB does not (by design) support transactions (i.e. ACID) so the only option possible strategy is the one DatabaseCleaner already supports: truncation.

WRT to the "ActiveRecord::ConnectionNotEstablished "error please see the " DatabaseCleaner is trying to use the wrong ORM" in the Common Errors section of the README:
https://github.com/bmabey/database_cleaner/blob/master/README.textile

HTH,
Ben
Reply all
Reply to author
Forward
0 new messages