minor: added a new group test
This commit is contained in:
parent
8e79793053
commit
59ba221066
|
@ -130,6 +130,11 @@ class TestCollection < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_safe_responses
|
||||
response = @@test.insert({:a => 1}, :safe => true)
|
||||
assert_equal false, response
|
||||
end
|
||||
|
||||
def test_maximum_insert_size
|
||||
docs = []
|
||||
16.times do
|
||||
|
@ -576,6 +581,23 @@ class TestCollection < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
context "Grouping with key" do
|
||||
setup do
|
||||
@@test.remove
|
||||
@@test.save("a" => 1, "pop" => 100)
|
||||
@@test.save("a" => 1, "pop" => 100)
|
||||
@@test.save("a" => 2, "pop" => 100)
|
||||
@@test.save("a" => 2, "pop" => 100)
|
||||
@initial = {"count" => 0, "foo" => 1}
|
||||
@reduce_function = "function (obj, prev) { prev.count += obj.pop; }"
|
||||
end
|
||||
|
||||
should "group" do
|
||||
result = @@test.group([:a], {}, @initial, @reduce_function, nil)
|
||||
assert result.all? { |r| r['count'] == 200 }
|
||||
end
|
||||
end
|
||||
|
||||
context "Grouping with a key function" do
|
||||
setup do
|
||||
@@test.remove
|
||||
|
|
Loading…
Reference in New Issue