Giter Site home page Giter Site logo

Comments (7)

bmabey avatar bmabey commented on August 26, 2024

Hmm... I've been using Mongoid with v0.6.x for several months now. I've been using it without a problem with Rails 3.0. Did you set the strategy to be :truncation?

from database_cleaner.

stonegao avatar stonegao commented on August 26, 2024

yes. I tried DatabaseCleaner[:mongoid].strategy = :truncation, it failed.

Now I am using v0.5.2 with config :
DatabaseCleaner.orm = "mongoid"
DatabaseCleaner.strategy = :truncation

it works.

from database_cleaner.

bmabey avatar bmabey commented on August 26, 2024

Any way you could reproduce this in a new project and push it to github? Something different in your setup is causing this bug where my setup and the tests are not catching...

from database_cleaner.

stonegao avatar stonegao commented on August 26, 2024

Hi, I pushed a example project at: git://github.com/stonegao/databasecleaner-debug.git
you can run:

rake spec

to reproduce the bug

from database_cleaner.

bmabey avatar bmabey commented on August 26, 2024

Thanks for taking the time for creating this! I was quickly able to spot the problem. The main problem is that DatabaseCleaner was not converting the orm type into symbols. So, you were passing "mongoid" but internally symbols are used for comparison and since #to_sym was never being called there were issues...

This has also brought up a couple more issues where DatabaseCleaner could issue better warnings and provide better documentation. Anyways, I will work on some patches to avoid these issues in the future. For now, take a look at my commit to see what I had to do to make it work correctly:

bmabey/databasecleaner-debug@0c924cf

from database_cleaner.

stonegao avatar stonegao commented on August 26, 2024

cool. thanks for the fix :-)

from database_cleaner.

bmabey avatar bmabey commented on August 26, 2024

I just pushed a fix to database_cleaner's master and have created a new ticket based off of another bug I found with this setup. Thanks again!

from database_cleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.