aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/configuration_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/configuration_test.rb')
-rw-r--r--activerecord/test/cases/configuration_test.rb26
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