Skip to content

Not cleaning collections in other Mongo sessions #2

@White-Oak

Description

@White-Oak

Not sure if this is fixable, but we have a supporting rails app, that looks for its data in a main's app db.
So some models have this code:

class User
    store_in collection: 'users', session: 'main_app'
...

These collections are not cleaned by DatabseCleaner. To fix this we need to use:

  config.after(:each) do
    DatabaseCleaner[:mongoid].clean
    Mongoid.session('main_app').collections.each do |collection|
      collection.drop
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions