test/serializers/json_serializer_test.rb in purzelrakete-restful-0.2.14 vs test/serializers/json_serializer_test.rb in purzelrakete-restful-0.2.15

- old
+ new

@@ -1,9 +1,9 @@ require File.dirname(__FILE__) + '/../test_helper.rb' context "json serializer" do - + setup do Person.restful_publish(:name, :current_location, :pets, :wallet, :created_at) Pet.restful_publish(:name) Wallet.restful_publish(:contents) @@ -64,11 +64,11 @@ 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 specify "should be able to serialize a map" do Person.restful_publish(:name) @@ -77,6 +77,14 @@ specify "should be able to serialize a map with arrays as values" do Person.restful_publish(:name) json_should_eql_fixture({ "total_hits" => 2, "people" => [ @person, @person ] }.to_restful_json, "people", :hash_with_people) end -end + + specify 'should serialize a hash with include option correctly - the include option should be passed to the values' do + Person.restful_publish(:name) + Wallet.restful_publish(:contents) + + json = {:person => @person}.to_restful_json(:include => :wallet) + json_should_eql_fixture(json, "people", :hash_with_rich_person) + end +end \ No newline at end of file