spec/support/mongoid.rb in activity_feed-2.2.2 vs spec/support/mongoid.rb in activity_feed-2.3.0
- old
+ new
@@ -1,11 +1,15 @@
require 'mongoid'
-Mongoid.configure do |config|
- config.master = Mongo::Connection.new.db("activity_feed_gem_test")
-end
+# If using Mongoid 2.x
+# Mongoid.configure do |config|
+# config.master = Mongo::Connection.new.db("activity_feed_gem_test")
+# end
+# If using Mongoid 3.x
+Mongoid.load!("#{File.dirname(__FILE__)}/mongoid.yml", :test)
+
DatabaseCleaner[:mongoid].strategy = :truncation
module ActivityFeed
module Mongoid
class Item
@@ -21,10 +25,14 @@
field :text, :type => String
field :url, :type => String
field :icon, :type=> String
field :sticky, :type=> Boolean
- index :user_id
+ # If using Mongoid 2.x
+ # index :user_id
+
+ # If using Mongoid 3.x
+ index({ user_id: 1})
after_save :update_activity_feed
private
\ No newline at end of file