0
require 'abstract_unit'
0
require "fixtures/person"
0
+require "fixtures/customer"
0
require "fixtures/street_address"
0
require "fixtures/beast"
0
@@ -15,6 +16,37 @@ class BaseTest < Test::Unit::TestCase
0
@people_david = [{ :id => 2, :name => 'David' }].to_xml(:root => 'people')
0
@addresses = [{ :id => 1, :street => '12345 Street' }].to_xml(:root => 'addresses')
0
+ # - deep nested resource -
0
+ # - JK (Customer::Friend)
0
+ # - Mateo (Customer::Friend::Brother)
0
+ # - Edith (Customer::Friend::Brother::Child)
0
+ # - Martha (Customer::Friend::Brother::Child)
0
+ # - Felipe (Customer::Friend::Brother)
0
+ # - Bryan (Customer::Friend::Brother::Child)
0
+ # - Luke (Customer::Friend::Brother::Child)
0
+ # - Eduardo (Customer::Friend)
0
+ # - Sebas (Customer::Friend::Brother)
0
+ # - Andres (Customer::Friend::Brother::Child)
0
+ # - Jorge (Customer::Friend::Brother::Child)
0
+ # - Elsa (Customer::Friend::Brother)
0
+ # - Natacha (Customer::Friend::Brother::Child)
0
+ # - Milena (Customer::Friend::Brother)
0
+ @luis = {:id => 1, :name => 'Luis',
0
+ :friends => [{:name => 'JK',
0
+ :brothers => [{:name => 'Mateo',
0
+ :children => [{:name => 'Edith'},{:name => 'Martha'}]},
0
+ :children => [{:name => 'Bryan'},{:name => 'Luke'}]}]},
0
+ :brothers => [{:name => 'Sebas',
0
+ :children => [{:name => 'Andres'},{:name => 'Jorge'}]},
0
+ :children => [{:name => 'Natacha'}]},
0
+ :children => []}]}]}.to_xml(:root => 'customer')
0
ActiveResource::HttpMock.respond_to do |mock|
0
mock.get "/people/1.xml", {}, @matz
0
mock.get "/people/2.xml", {}, @david
0
@@ -46,6 +78,8 @@ class BaseTest < Test::Unit::TestCase
0
mock.head "/people/1/addresses/2.xml", {}, nil, 404
0
mock.head "/people/2/addresses/1.xml", {}, nil, 404
0
mock.head "/people/Greg/addresses/1.xml", {}, nil, 200
0
+ mock.get "/customers/1.xml", {}, @luis
0
@@ -788,4 +822,18 @@ class BaseTest < Test::Unit::TestCase
0
assert_equal '1', matz.to_param
0
+ def test_parse_deep_nested_resources
0
+ luis = Customer.find(1)
0
+ assert_kind_of Customer, luis
0
+ luis.friends.each do |friend|
0
+ assert_kind_of Customer::Friend, friend
0
+ friend.brothers.each do |brother|
0
+ assert_kind_of Customer::Friend::Brother, brother
0
+ brother.children.each do |child|
0
+ assert_kind_of Customer::Friend::Brother::Child, child
Comments
No one has commented yet.