test/unit/storage.rb in ruote-2.1.9 vs test/unit/storage.rb in ruote-2.1.10

- old
+ new

@@ -22,10 +22,11 @@ '_id' => 'toto', 'type' => 'dogfood', 'message' => 'testing') end def teardown + @s.get_many('dogfood').each { |d| @s.delete(d) } end def test_get_configuration @@ -90,10 +91,23 @@ r = @s.put(doc) assert_nil r end + def test_put_update_rev_twice + + doc = { '_id' => 'ouinouin', 'type' => 'dogfood', 'message' => 'more' } + + r = @s.put(doc, :update_rev => true) + assert_nil r + + doc = { '_id' => 'ouinouin', 'type' => 'dogfood', 'message' => 'more' } + + r = @s.put(doc, :update_rev => true) + assert_not_nil r + end + def test_delete_fail assert_raise(ArgumentError) do @s.delete('_id' => 'toto') end @@ -151,11 +165,11 @@ @s.put('_id' => 'ouinouin', 'type' => 'dogfood', 'message' => 'testing') @s.put('_id' => 'nada', 'type' => 'dogfood', 'message' => 'testing') @s.put('_id' => 'estereo', 'type' => 'dogfood', 'message' => 'testing') - assert_equal %w[ estereo nada ouinouin toto ], @s.ids('dogfood') + assert_equal %w[ estereo nada ouinouin toto ], @s.ids('dogfood').sort end def test_get_many 30.times do |i| @@ -163,8 +177,10 @@ end assert_equal 31, @s.get_many('dogfood').size assert_equal 10, @s.get_many('dogfood', nil, :limit => 10).size assert_equal 1, @s.get_many('dogfood', /!7$/).size + assert_equal 30, @s.get_many('dogfood', /^xx!/).size + assert_equal 30, @s.get_many('dogfood', /x/).size end end