From 4424eaa77ba0171bb9d685dc03c40e88782fea58 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Thu, 14 Aug 2014 09:25:31 -0700 Subject: [PATCH] Only re-define BSON::ObjectId's <=> operator for mongoid2. --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 0a780cc..7c9804d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,7 +19,7 @@ if defined?(Mongoid) end # Mongoid2 uses BSON gem. We need to re-define <=> in order for TestSql.test_order_id to pass. - if defined?(BSON) && defined?(BSON::ObjectId) + if Mongoid.mongoid2? && defined?(BSON) && defined?(BSON::ObjectId) module BSON class ObjectId def <=>(other) -- libgit2 0.21.0