diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-10-19 12:33:36 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-10-19 12:33:36 -0700 |
commit | a49c3b03650b3193cc9440a3b219ab7f19326297 (patch) | |
tree | dd68d637a074bc08d1328d780aeb092b2a4c8874 /activerecord/test/cases/attributes/aliasing_test.rb | |
parent | 028911ad00e7f7733064a80393a1548401bba7af (diff) | |
parent | 1ac5cf478825391071d34ec3d7f294fe28c0fceb (diff) | |
download | rails-a49c3b03650b3193cc9440a3b219ab7f19326297.tar.gz rails-a49c3b03650b3193cc9440a3b219ab7f19326297.tar.bz2 rails-a49c3b03650b3193cc9440a3b219ab7f19326297.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/test/cases/attributes/aliasing_test.rb')
-rw-r--r-- | activerecord/test/cases/attributes/aliasing_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/cases/attributes/aliasing_test.rb b/activerecord/test/cases/attributes/aliasing_test.rb new file mode 100644 index 0000000000..7ee25779f1 --- /dev/null +++ b/activerecord/test/cases/attributes/aliasing_test.rb @@ -0,0 +1,20 @@ +require "cases/helper" + +class AliasingTest < ActiveRecord::TestCase + + class AliasingAttributes < Hash + include ActiveRecord::Attributes::Aliasing + end + + test "attribute access with aliasing" do + attributes = AliasingAttributes.new + attributes[:name] = 'Batman' + attributes.aliases['nickname'] = 'name' + + assert_equal 'Batman', attributes[:name], "Symbols should point to Strings" + assert_equal 'Batman', attributes['name'] + assert_equal 'Batman', attributes['nickname'] + assert_equal 'Batman', attributes[:nickname] + end + +end |