From 6e61681be13219f9ae76c856333c9067a5c9c78d Mon Sep 17 00:00:00 2001
From: Thu Trang Pham <thuutrangpham@gmail.com>
Date: Thu, 30 Apr 2015 22:06:14 +0000
Subject: [PATCH] Fix mongoid test for Mogoid versions >= 4.0.0

---
 test/unit/mongoid_test.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/unit/mongoid_test.rb b/test/unit/mongoid_test.rb
index 78fd4a04..5783477d 100644
--- a/test/unit/mongoid_test.rb
+++ b/test/unit/mongoid_test.rb
@@ -33,7 +33,11 @@ class MongoidTest < GeocoderTestCase
   end
 
   def test_index_is_skipped_if_skip_option_flag
-    result = PlaceUsingMongoidWithoutIndex.index_options.keys.flatten[0] == :coordinates
+    if PlaceUsingMongoidWithoutIndex.respond_to?(:index_options)
+      result = PlaceUsingMongoidWithoutIndex.index_options.keys.flatten[0] == :coordinates
+    else
+      result = PlaceUsingMongoidWithoutIndex.index_specifications[0] == :coordinates
+    end
     assert !result
   end
 
-- 
GitLab