aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-07-15 21:24:00 -0500
committerJoshua Peek <josh@joshpeek.com>2008-07-15 22:01:02 -0500
commitf4f6e57e8c2a446a4a600576f0caf0fb8921ba13 (patch)
treee3541a545c85cc00a5182532b4c2b6d9376c815d /activesupport/test
parent89eec91e670ae267cd88b2b3555bfefe527f0eaa (diff)
downloadrails-f4f6e57e8c2a446a4a600576f0caf0fb8921ba13.tar.gz
rails-f4f6e57e8c2a446a4a600576f0caf0fb8921ba13.tar.bz2
rails-f4f6e57e8c2a446a4a600576f0caf0fb8921ba13.zip
Added Object#metaclass
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/object_and_class_ext_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb
index 16f4ab888e..b0a746fdc7 100644
--- a/activesupport/test/core_ext/object_and_class_ext_test.rb
+++ b/activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -173,6 +173,14 @@ class ObjectTests < Test::Unit::TestCase
assert duck.acts_like?(:time)
assert !duck.acts_like?(:date)
end
+
+ def test_metaclass
+ string = "Hello"
+ string.metaclass.instance_eval do
+ define_method(:foo) { "bar" }
+ end
+ assert_equal "bar", string.foo
+ end
end
class ObjectInstanceVariableTest < Test::Unit::TestCase