spec/ruby/faye_spec.rb in faye-0.8.1 vs spec/ruby/faye_spec.rb in faye-0.8.2
- old
+ new
@@ -9,6 +9,22 @@
it "always produces the same length of string" do
ids = (1..100).map { Faye.random }
ids.should be_all { |id| id.size == 25 }
end
end
+
+ describe :copy_obect do
+ let(:object) { {"foo" => "bar", "qux" => 42, "hey" => nil, "obj" => {"bar" => 67}} }
+
+ it "returns an equal object" do
+ Faye.copy_object(object).should == {"foo" => "bar", "qux" => 42, "hey" => nil, "obj" => {"bar" => 67}}
+ end
+
+ it "does not return the same object" do
+ Faye.copy_object(object).should_not be_equal(object)
+ end
+
+ it "performs a deep clone" do
+ Faye.copy_object(object)["obj"].should_not be_equal(object["obj"])
+ end
+ end
end