aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test/cases/base
diff options
context:
space:
mode:
authorTaryn East <git@taryneast.org>2009-10-02 10:13:40 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-02 10:13:40 -0500
commit8377646d68b32de362fefad0d752a923f6b36da6 (patch)
treea2f4b8d2d9b4021acc5efc551ec7578d5e24d923 /activeresource/test/cases/base
parentf4f68885efd0e1135217433cafd368902b1fd58a (diff)
downloadrails-8377646d68b32de362fefad0d752a923f6b36da6.tar.gz
rails-8377646d68b32de362fefad0d752a923f6b36da6.tar.bz2
rails-8377646d68b32de362fefad0d752a923f6b36da6.zip
add indifferent access to the attributes
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activeresource/test/cases/base')
-rw-r--r--activeresource/test/cases/base/load_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activeresource/test/cases/base/load_test.rb b/activeresource/test/cases/base/load_test.rb
index 1952f5b5f0..53fa94d07f 100644
--- a/activeresource/test/cases/base/load_test.rb
+++ b/activeresource/test/cases/base/load_test.rb
@@ -68,6 +68,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