diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-23 21:37:52 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-24 11:08:15 +0000 |
commit | ba7ec73f6a5c98c008e8e48eb06e9b9a17a91991 (patch) | |
tree | 32501c519056e017537da0c80c9a8e787cb211b4 /activerecord/test/cases/configuration_test.rb | |
parent | 8c67e709d0b2946473af84959deaac0ced962d5e (diff) | |
download | rails-ba7ec73f6a5c98c008e8e48eb06e9b9a17a91991.tar.gz rails-ba7ec73f6a5c98c008e8e48eb06e9b9a17a91991.tar.bz2 rails-ba7ec73f6a5c98c008e8e48eb06e9b9a17a91991.zip |
Deal with global config better between AR::Base and AR::Model
Diffstat (limited to 'activerecord/test/cases/configuration_test.rb')
-rw-r--r-- | activerecord/test/cases/configuration_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/cases/configuration_test.rb b/activerecord/test/cases/configuration_test.rb new file mode 100644 index 0000000000..872f1fc33b --- /dev/null +++ b/activerecord/test/cases/configuration_test.rb @@ -0,0 +1,26 @@ +require 'cases/helper' + +class ConfigurationTest < ActiveRecord::TestCase + def test_configuration + @klass = Class.new do + include ActiveRecord::Configuration + end + + ActiveRecord::Configuration.define :omg + + ActiveRecord::Configuration.omg = "omg" + + assert_equal "omg", @klass.new.omg + assert !@klass.new.respond_to?(:omg=) + assert_equal "omg", @klass.omg + + @klass.omg = "wtf" + + assert_equal "wtf", @klass.omg + assert_equal "wtf", @klass.new.omg + ensure + ActiveRecord::Configuration.send(:undef_method, :omg) + ActiveRecord::Configuration::ClassMethods.send(:undef_method, :omg) + ActiveRecord::Configuration::ClassMethods.send(:undef_method, :omg=) + end +end |