class ObjectInstanceVariableTest
Public Instance Methods
setup()
click to toggle source
# File activesupport/test/core_ext/object/instance_variables_test.rb, line 7 def setup @source, @dest = Object.new, Object.new @source.instance_variable_set(:@bar, "bar") @source.instance_variable_set(:@baz, "baz") end
test_instance_exec_nested()
click to toggle source
# File activesupport/test/core_ext/object/instance_variables_test.rb, line 29 def test_instance_exec_nested assert_equal %w(goodbye olleh bar), "hello".instance_exec("goodbye") { |arg| [arg] + instance_exec("bar") { |v| [reverse, v] } } end
test_instance_exec_passes_arguments_to_block()
click to toggle source
# File activesupport/test/core_ext/object/instance_variables_test.rb, line 21 def test_instance_exec_passes_arguments_to_block assert_equal %w(hello goodbye), "hello".instance_exec("goodbye") { |v| [self, v] } end
test_instance_exec_with_frozen_obj()
click to toggle source
# File activesupport/test/core_ext/object/instance_variables_test.rb, line 25 def test_instance_exec_with_frozen_obj assert_equal %w(olleh goodbye), "hello".freeze.instance_exec("goodbye") { |v| [reverse, v] } end
test_instance_values()
click to toggle source
# File activesupport/test/core_ext/object/instance_variables_test.rb, line 17 def test_instance_values assert_equal({ "bar" => "bar", "baz" => "baz" }, @source.instance_values) end
test_instance_variable_names()
click to toggle source
# File activesupport/test/core_ext/object/instance_variables_test.rb, line 13 def test_instance_variable_names assert_equal %w(@bar @baz), @source.instance_variable_names.sort end