aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-09-02 08:31:11 +0000
committerJamis Buck <jamis@37signals.com>2005-09-02 08:31:11 +0000
commit69d662051e609f8fc3e28d2c77a917cd0befddca (patch)
treed87ffe6b3df701eee9fbf22ccc43a5ff9cf4b864 /activerecord/test/base_test.rb
parent46c4fd4177550142b3071806376e3df4ac1b4d2e (diff)
downloadrails-69d662051e609f8fc3e28d2c77a917cd0befddca.tar.gz
rails-69d662051e609f8fc3e28d2c77a917cd0befddca.tar.bz2
rails-69d662051e609f8fc3e28d2c77a917cd0befddca.zip
Modify read_attribute to allow a symbol argument #2024 [Ken Kunz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 249c4116a6..b12d0c941d 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -180,6 +180,16 @@ class BasicsTest < Test::Unit::TestCase
assert_equal "Still another topic: part 2", topic.title
end
+ def test_read_attribute
+ topic = Topic.new
+ topic.title = "Don't change the topic"
+ assert_equal "Don't change the topic", topic.send(:read_attribute, "title")
+ assert_equal "Don't change the topic", topic["title"]
+
+ assert_equal "Don't change the topic", topic.send(:read_attribute, :title)
+ assert_equal "Don't change the topic", topic[:title]
+ end
+
def test_read_attribute_when_false
topic = topics(:first)
topic.approved = false