diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-10-10 17:15:11 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-10-10 17:15:11 +0100 |
commit | 66ee2654ff243f03595a402fa15e1eea1b5b45be (patch) | |
tree | 3f1055e03082f0c767719e8cba5155e4207779e0 /activeresource/test/cases/base/load_test.rb | |
parent | dd2779e1b83b4d867d47dd286ec0c919f5df12a9 (diff) | |
parent | b9ce8216fa849a47ad0b0f99fa510e226a23c12e (diff) | |
download | rails-66ee2654ff243f03595a402fa15e1eea1b5b45be.tar.gz rails-66ee2654ff243f03595a402fa15e1eea1b5b45be.tar.bz2 rails-66ee2654ff243f03595a402fa15e1eea1b5b45be.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'activeresource/test/cases/base/load_test.rb')
-rw-r--r-- | activeresource/test/cases/base/load_test.rb | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/activeresource/test/cases/base/load_test.rb b/activeresource/test/cases/base/load_test.rb index 1952f5b5f0..189a4d81fe 100644 --- a/activeresource/test/cases/base/load_test.rb +++ b/activeresource/test/cases/base/load_test.rb @@ -15,26 +15,21 @@ module Highrise module Deeply module Nested - class Note < ActiveResource::Base self.site = "http://37s.sunrise.i:3000" end - class Comment < ActiveResource::Base - self.site = "http://37s.sunrise.i:3000" - end - - module TestDifferentLevels - - class Note < ActiveResource::Base - self.site = "http://37s.sunrise.i:3000" - end - - end + class Comment < ActiveResource::Base + self.site = "http://37s.sunrise.i:3000" + end + module TestDifferentLevels + class Note < ActiveResource::Base + self.site = "http://37s.sunrise.i:3000" + end + end end end - end @@ -68,6 +63,19 @@ class BaseLoadTest < Test::Unit::TestCase assert_equal @matz.stringify_keys, @person.load(@matz).attributes end + def test_after_load_attributes_are_accessible + assert_equal Hash.new, @person.attributes + assert_equal @matz.stringify_keys, @person.load(@matz).attributes + assert_equal @matz[:name], @person.attributes['name'] + end + + def test_after_load_attributes_are_accessible_via_indifferent_access + assert_equal Hash.new, @person.attributes + assert_equal @matz.stringify_keys, @person.load(@matz).attributes + assert_equal @matz[:name], @person.attributes['name'] + assert_equal @matz[:name], @person.attributes[:name] + end + def test_load_one_with_existing_resource address = @person.load(:street_address => @first_address).street_address assert_kind_of StreetAddress, address @@ -143,7 +151,7 @@ class BaseLoadTest < Test::Unit::TestCase assert_kind_of String, places.first assert_equal @deep[:street][:state][:places].first, places.first end - + def test_nested_collections_within_the_same_namespace n = Highrise::Note.new(:comments => [{ :name => "1" }]) assert_kind_of Highrise::Comment, n.comments.first @@ -158,6 +166,4 @@ class BaseLoadTest < Test::Unit::TestCase n = Highrise::Deeply::Nested::TestDifferentLevels::Note.new(:comments => [{ :name => "1" }]) assert_kind_of Highrise::Deeply::Nested::Comment, n.comments.first end - - end |