1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/attributes/aliasing_test.rb
Eric Chapweske f936a1f100 Refactoring attributes/types [#3348 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-17 12:37:15 -05:00

20 lines
554 B
Ruby

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