Skip to content

Commit

Permalink
Fix database object for mongoid version beyond 5
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhakar97 committed Jun 27, 2016
1 parent f052d64 commit 3cf0d1b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/database_cleaner/mongoid/truncation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ def database

include ::DatabaseCleaner::Mongo2::TruncationMixin

alias super_database database

private

def database
if ::Mongoid::VERSION > '5'
::Mongoid.default_client.database
else
super_database
end
end

end
end
end
Expand Down

0 comments on commit 3cf0d1b

Please sign in to comment.