From 797fada848bdcc9aab57f615bc601e66766cd405 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Mon, 3 May 2010 17:40:55 -0400 Subject: [PATCH] make sure we support --- test/collection_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/collection_test.rb b/test/collection_test.rb index f198ebd..2557242 100644 --- a/test/collection_test.rb +++ b/test/collection_test.rb @@ -272,6 +272,16 @@ class TestCollection < Test::Unit::TestCase end end + if @@version <= "1.5.1" + def test_fields_with_slice + @@test.save({:foo => [1, 2, 3, 4, 5, 6], :test => 'slice'}) + + doc = @@test.find_one({:test => 'slice'}, :fields => {'foo' => {'$slice' => [0, 3]}}) + assert_equal [1, 2, 3], doc['foo'] + @@test.remove + end + end + def test_find_one id = @@test.save("hello" => "world", "foo" => "bar")