diff options
Diffstat (limited to 'activeresource/test/format_test.rb')
-rw-r--r-- | activeresource/test/format_test.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/activeresource/test/format_test.rb b/activeresource/test/format_test.rb index 01cc162075..3194c2dcd1 100644 --- a/activeresource/test/format_test.rb +++ b/activeresource/test/format_test.rb @@ -85,20 +85,20 @@ class FormatTest < Test::Unit::TestCase end def test_serialization_of_nested_resource - address = { :street => '12345 Street' } - person = { :name=> 'Rus', :address => address} + address = { :street => '12345 Street' } + person = { :name=> 'Rus', :address => address} - [:json, :xml].each do |format| - encoded_person = ActiveResource::Formats[format].encode(person) - assert_match(/12345 Street/, encoded_person) - remote_person = Person.new(person.update({:address => StreetAddress.new(address)})) - assert_kind_of StreetAddress, remote_person.address - using_format(Person, format) do - ActiveResource::HttpMock.respond_to.post "/people.#{format}", {'Content-Type' => ActiveResource::Formats[format].mime_type}, encoded_person, 201, {'Location' => "/people/5.#{format}"} - remote_person.save - end - end - end + [:json, :xml].each do |format| + encoded_person = ActiveResource::Formats[format].encode(person) + assert_match(/12345 Street/, encoded_person) + remote_person = Person.new(person.update({:address => StreetAddress.new(address)})) + assert_kind_of StreetAddress, remote_person.address + using_format(Person, format) do + ActiveResource::HttpMock.respond_to.post "/people.#{format}", {'Content-Type' => ActiveResource::Formats[format].mime_type}, encoded_person, 201, {'Location' => "/people/5.#{format}"} + remote_person.save + end + end + end private def using_format(klass, mime_type_reference) |