spec/amf/serializer_spec.rb in RocketAMF-0.0.6 vs spec/amf/serializer_spec.rb in RocketAMF-0.0.7
- old
+ new
@@ -153,11 +153,11 @@
output = RocketAMF.serialize(input, 3)
output.should == expected
end
#BAH! Who sends XML over AMF?
- it "should serialize a REXML document"
+ it "should serialize XML"
end
describe "objects" do
it "should serialize an unmapped object as a dynamic anonymous object" do
class NonMappedObject
@@ -223,11 +223,16 @@
input = [h1, h2, so1, SimpleObj.new, {}, [h1, h2, so1], [], 42, "", [], "", {}, "bar_one", so1]
output = RocketAMF.serialize(input, 3)
output.should == expected
end
- it "should serialize a byte array"
+ it "should serialize a byte array" do
+ expected = object_fixture("amf3-byteArray.bin")
+ input = StringIO.new "\000\003これtest\100"
+ output = RocketAMF.serialize(input, 3)
+ output.should == expected
+ end
end
describe "and implementing the AMF Spec" do
it "should keep references of duplicate strings" do
class StringCarrier
@@ -294,10 +299,18 @@
output = RocketAMF.serialize(input, 3)
output.should == expected
end
it "should keep references of duplicate XML and XMLDocuments"
- it "should keep references of duplicate byte arrays"
+
+ it "should keep references of duplicate byte arrays" do
+ b = StringIO.new "ASDF"
+
+ expected = object_fixture("amf3-byteArrayRef.bin")
+ input = [b, b]
+ output = RocketAMF.serialize(input, 3)
+ output.should == expected
+ end
it "should serialize a deep object graph with circular references" do
class GraphMember
attr_accessor :parent
attr_accessor :children
\ No newline at end of file