Upgrade to Rails 2.2.0
As a side benefit, fix an (non-user-visible) bug in display_s5(). Also fixed a bug where removing orphaned pages did not expire cached summary pages.
This commit is contained in:
parent
39348c65c2
commit
7600aef48b
827 changed files with 123652 additions and 11027 deletions
17
vendor/rails/activeresource/test/format_test.rb
vendored
17
vendor/rails/activeresource/test/format_test.rb
vendored
|
@ -1,5 +1,6 @@
|
|||
require 'abstract_unit'
|
||||
require "fixtures/person"
|
||||
require "fixtures/street_address"
|
||||
|
||||
class FormatTest < Test::Unit::TestCase
|
||||
def setup
|
||||
|
@ -83,6 +84,22 @@ class FormatTest < Test::Unit::TestCase
|
|||
assert_equal ActiveResource::Formats[:json], resource.connection.format
|
||||
end
|
||||
|
||||
def test_serialization_of_nested_resource
|
||||
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
|
||||
|
||||
private
|
||||
def using_format(klass, mime_type_reference)
|
||||
previous_format = klass.format
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue