diff options
author | thedarkone <thedarkone2@gmail.com> | 2010-09-27 14:50:39 +0200 |
---|---|---|
committer | thedarkone <thedarkone2@gmail.com> | 2010-09-27 17:45:58 +0200 |
commit | 918dc27345319fbabf25a43bd65b613878b3a66e (patch) | |
tree | 9384f88171b155ac6655d70c2448e4e8a364fe32 /activesupport/test | |
parent | 7918a5c96604b6c2d8a60542b7afc9e445c43fba (diff) | |
download | rails-918dc27345319fbabf25a43bd65b613878b3a66e.tar.gz rails-918dc27345319fbabf25a43bd65b613878b3a66e.tar.bz2 rails-918dc27345319fbabf25a43bd65b613878b3a66e.zip |
Compile ActionController::Base.config's methods to avoid method_missing overhead.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/configurable_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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 |