Created alias Collection#size for Collection#count
This commit is contained in:
parent
d1a07f4b36
commit
5ea585a475
@ -395,6 +395,8 @@ EOS
|
||||
find().count()
|
||||
end
|
||||
|
||||
alias :size :count
|
||||
|
||||
protected
|
||||
|
||||
def normalize_hint_fields(hint)
|
||||
|
@ -112,6 +112,17 @@ class TestCollection < Test::Unit::TestCase
|
||||
assert_equal 2, @@test.count
|
||||
end
|
||||
|
||||
# Note: #size is just an alias for #count.
|
||||
def test_size
|
||||
@@test.drop
|
||||
|
||||
assert_equal 0, @@test.count
|
||||
assert_equal @@test.size, @@test.count
|
||||
@@test.save("x" => 1)
|
||||
@@test.save("x" => 2)
|
||||
assert_equal @@test.size, @@test.count
|
||||
end
|
||||
|
||||
def test_find_one
|
||||
id = @@test.save("hello" => "world", "foo" => "bar")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user