From 918dc27345319fbabf25a43bd65b613878b3a66e Mon Sep 17 00:00:00 2001 From: thedarkone Date: Mon, 27 Sep 2010 14:50:39 +0200 Subject: Compile ActionController::Base.config's methods to avoid method_missing overhead. --- activesupport/test/configurable_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/configurable_test.rb b/activesupport/test/configurable_test.rb index cef67e3cf9..4f288eb4d5 100644 --- a/activesupport/test/configurable_test.rb +++ b/activesupport/test/configurable_test.rb @@ -39,4 +39,22 @@ class ConfigurableActiveSupport < ActiveSupport::TestCase assert_equal :baz, instance.config.foo assert_equal :bar, Parent.config.foo end + + test "configuration is crystalizeable" do + parent = Class.new { include ActiveSupport::Configurable } + 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) + + parent.config.crystalize! + 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 + end end \ No newline at end of file -- cgit v1.2.3