test/serializers/json_serializer_test.rb in purzelrakete-restful-0.2.4 vs test/serializers/json_serializer_test.rb in purzelrakete-restful-0.2.5
- old
+ new
@@ -19,10 +19,11 @@
json_should_eql_fixture(@person.to_restful_json, "people", :bloggs)
end
specify "should be able to serialize objects with empty collections" do
@person.pets = []
+
assert_nothing_raised do
json_should_eql_fixture(@person.to_restful_json, "people", :bloggs_da_pet_hater)
end
end
@@ -59,6 +60,13 @@
end
specify "should serialize collections correctly" do
json_should_eql_fixture(@person.pets.to_restful_json, "pets", :pets_array)
end
+
+ specify "should be able to serialize collections with total entries info" do
+ pets = PaginatedCollection.new(@person.pets)
+ pets.total_entries = 1001
+
+ json_should_eql_fixture(pets.to_restful_json, "pets", :pets_array_with_total_entries)
+ end
end