minor: cleaner output for cursor inspect
This commit is contained in:
parent
a24448d911
commit
2121d6c809
|
@ -275,6 +275,12 @@ module Mongo
|
|||
:timeout => @timeout }
|
||||
end
|
||||
|
||||
# Clean output for inspect.
|
||||
def inspect
|
||||
"<Mongo::Cursor:0x#{object_id.to_s(16)} namespace='#{@db.name}.#{@collection.name}' " +
|
||||
"@selector=#{@selector.inspect}>"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Convert the +:fields+ parameter from a single field name or an array
|
||||
|
|
|
@ -17,6 +17,13 @@ class CursorTest < Test::Unit::TestCase
|
|||
@@coll_full_name = "#{MONGO_TEST_DB}.test"
|
||||
end
|
||||
|
||||
def test_inspect
|
||||
selector = {:a => 1}
|
||||
cursor = @@coll.find(selector)
|
||||
assert_equal "<Mongo::Cursor:0x#{cursor.object_id.to_s(16)} namespace='#{@@db.name}.#{@@coll.name}' " +
|
||||
"@selector=#{selector.inspect}>", cursor.inspect
|
||||
end
|
||||
|
||||
def test_explain
|
||||
cursor = @@coll.find('a' => 1)
|
||||
explaination = cursor.explain
|
||||
|
|
Loading…
Reference in New Issue