From 935f8215371d68f36950c709061e5876ecadaa89 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 27 Sep 2007 10:13:50 +0000 Subject: Object#copy_instance_variables_from Ruby 1.9 compat git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/object_and_class_ext_test.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'activesupport/test/core_ext/object_and_class_ext_test.rb') 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 5e6144d64c..1987b70589 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -65,7 +65,7 @@ class ClassExtTest < Test::Unit::TestCase def test_subclasses_of_should_not_return_removed_classes # First create the removed class - old_class = Nested.send :remove_const, :ClassL + old_class = Nested.class_eval { remove_const :ClassL } new_class = Class.new(ClassK) Nested.const_set :ClassL, new_class assert_equal "Nested::ClassL", new_class.name # Sanity check @@ -85,7 +85,7 @@ class ClassExtTest < Test::Unit::TestCase assert !const_missing assert_equal [ Nested::ClassL ], subclasses - removed = Nested.send :remove_const, :ClassL # keep it in memory + removed = Nested.class_eval { remove_const :ClassL } # keep it in memory subclasses = Object.subclasses_of ClassK assert !const_missing assert subclasses.empty? @@ -188,7 +188,7 @@ class ObjectInstanceVariableTest < Test::Unit::TestCase assert_equal [], @dest.instance_variables @dest.copy_instance_variables_from(@source) - assert_equal %w(@bar @baz), @dest.instance_variables.sort + assert_equal %w(@bar @baz), @dest.instance_variables.sort.map(&:to_s) %w(@bar @baz).each do |name| assert_equal @source.instance_variable_get(name).object_id, @dest.instance_variable_get(name).object_id @@ -197,7 +197,7 @@ class ObjectInstanceVariableTest < Test::Unit::TestCase def test_copy_instance_variables_from_with_explicit_excludes @dest.copy_instance_variables_from(@source, ['@baz']) - assert !@dest.instance_variables.include?('@baz') + assert !@dest.instance_variable_defined?('@baz') assert_equal 'bar', @dest.instance_variable_get('@bar') end @@ -210,8 +210,8 @@ class ObjectInstanceVariableTest < Test::Unit::TestCase end @dest.copy_instance_variables_from(@source) - assert !@dest.instance_variables.include?('@bar') - assert !@dest.instance_variables.include?('@quux') + assert !@dest.instance_variable_defined?('@bar') + assert !@dest.instance_variable_defined?('@quux') assert_equal 'baz', @dest.instance_variable_get('@baz') end -- cgit v1.2.3