Commit 4424eaa77ba0171bb9d685dc03c40e88782fea58
1 parent
2556919e
Exists in
master
and in
21 other branches
Only re-define BSON::ObjectId's <=> operator for mongoid2.
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
test/test_helper.rb
@@ -19,7 +19,7 @@ if defined?(Mongoid) | @@ -19,7 +19,7 @@ if defined?(Mongoid) | ||
19 | end | 19 | end |
20 | 20 | ||
21 | # Mongoid2 uses BSON gem. We need to re-define <=> in order for TestSql.test_order_id to pass. | 21 | # Mongoid2 uses BSON gem. We need to re-define <=> in order for TestSql.test_order_id to pass. |
22 | - if defined?(BSON) && defined?(BSON::ObjectId) | 22 | + if Mongoid.mongoid2? && defined?(BSON) && defined?(BSON::ObjectId) |
23 | module BSON | 23 | module BSON |
24 | class ObjectId | 24 | class ObjectId |
25 | def <=>(other) | 25 | def <=>(other) |