diff options
author | Grzegorz Forysinski <grzegorz.forysinski@u2i.com> | 2009-08-09 18:24:49 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-09 23:39:38 +0100 |
commit | e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4 (patch) | |
tree | 5509a9c48decef6a1c79f7522c8e40d66706ec72 /activeresource/test/base | |
parent | 08ec22054f56442b10f67e41c3b7593da6adcabd (diff) | |
download | rails-e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4.tar.gz rails-e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4.tar.bz2 rails-e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4.zip |
Ensure ActiveResource#load works with numeric arrays [Grzegorz Forysinski, Elad Meidar]
[#2305 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activeresource/test/base')
-rw-r--r-- | activeresource/test/base/load_test.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/activeresource/test/base/load_test.rb b/activeresource/test/base/load_test.rb index 035bd965c2..5f5a580445 100644 --- a/activeresource/test/base/load_test.rb +++ b/activeresource/test/base/load_test.rb @@ -51,7 +51,9 @@ class BaseLoadTest < Test::Unit::TestCase :id => 1, :state => { :id => 1, :name => 'Oregon', :notable_rivers => [ { :id => 1, :name => 'Willamette' }, - { :id => 2, :name => 'Columbia', :rafted_by => @matz }] }}} + { :id => 2, :name => 'Columbia', :rafted_by => @matz }], + :postal_codes => [97018,1234567890], + :places => ["Columbia City", "Unknown"]}}} @person = Person.new end @@ -127,6 +129,19 @@ class BaseLoadTest < Test::Unit::TestCase assert_kind_of Person::Street::State::NotableRiver, rivers.first assert_equal @deep[:street][:state][:notable_rivers].first[:id], rivers.first.id assert_equal @matz[:id], rivers.last.rafted_by.id + + postal_codes = state.postal_codes + assert_kind_of Array, postal_codes + assert_equal 2, postal_codes.size + assert_kind_of Fixnum, postal_codes.first + assert_equal @deep[:street][:state][:postal_codes].first, postal_codes.first + assert_kind_of Bignum, postal_codes.last + assert_equal @deep[:street][:state][:postal_codes].last, postal_codes.last + + places = state.places + assert_kind_of Array, places + assert_kind_of String, places.first + assert_equal @deep[:street][:state][:places].first, places.first end def test_nested_collections_within_the_same_namespace |