test/unit/ut_17_storage.rb in ruote-2.1.1 vs test/unit/ut_17_storage.rb in ruote-2.1.2
- old
+ new
@@ -3,11 +3,15 @@
# testing ruote
#
# Mon Dec 14 15:03:13 JST 2009
#
-require 'yajl' rescue require 'json'
+begin
+ require 'yajl'
+rescue LoadError
+ require 'json'
+end
require 'patron' rescue nil
require File.join(File.dirname(__FILE__), %w[ .. test_helper.rb ])
require File.join(File.dirname(__FILE__), %w[ .. functional storage_helper.rb ])
@@ -42,12 +46,16 @@
assert_nil h
end
def test_put
- @s.put('_id' => 'nada', 'type' => 'dogfood', 'message' => 'testing again')
+ doc = { '_id' => 'nada', 'type' => 'dogfood', 'message' => 'testing (2)' }
+ @s.put(doc)
+
+ assert_nil doc['_rev']
+
h = @s.get('dogfood', 'nada')
assert_not_nil h['_rev']
end
@@ -91,12 +99,16 @@
assert_equal true, r
end
def test_keys_should_be_string
- require 'yajl' rescue require 'json'
- Rufus::Json.detect_backend
+ #begin
+ # require 'yajl'
+ #rescue LoadError
+ # require 'json'
+ #end
+ #Rufus::Json.detect_backend
doc = { '_id' => 'h0', 'type' => 'dogfood', :m0 => :z, :m1 => [ :a, :b ] }
@s.put(doc)
@@ -106,10 +118,10 @@
assert_equal %w[ a b ], doc['m1']
end
# Updating a gone document must result in a 'true' reply.
#
- def test_put_missing
+ def test_put_gone
h = @s.get('dogfood', 'toto')
assert_nil @s.delete(h)