aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/configurable_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/configurable_test.rb')
-rw-r--r--activesupport/test/configurable_test.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/activesupport/test/configurable_test.rb b/activesupport/test/configurable_test.rb
index c6d8191298..2e5ea2c360 100644
--- a/activesupport/test/configurable_test.rb
+++ b/activesupport/test/configurable_test.rb
@@ -58,16 +58,26 @@ class ConfigurableActiveSupport < ActiveSupport::TestCase
child = Class.new(parent)
parent.config.bar = :foo
- assert !parent.config.respond_to?(:bar)
- assert !child.config.respond_to?(:bar)
- assert !child.new.config.respond_to?(:bar)
+ assert_method_not_defined parent.config, :bar
+ assert_method_not_defined child.config, :bar
+ assert_method_not_defined child.new.config, :bar
parent.config.compile_methods!
assert_equal :foo, parent.config.bar
assert_equal :foo, child.new.config.bar
- assert_respond_to parent.config, :bar
- assert_respond_to child.config, :bar
- assert_respond_to child.new.config, :bar
+ assert_method_defined parent.config, :bar
+ assert_method_defined child.config, :bar
+ assert_method_defined child.new.config, :bar
+ end
+
+ def assert_method_defined(object, method)
+ methods = object.public_methods.map(&:to_s)
+ assert methods.include?(method.to_s), "Expected #{methods.inspect} to include #{method.to_s.inspect}"
+ end
+
+ def assert_method_not_defined(object, method)
+ methods = object.public_methods.map(&:to_s)
+ assert !methods.include?(method.to_s), "Expected #{methods.inspect} to not include #{method.to_s.inspect}"
end
end