diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/attribute_methods/read_test.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/configuration_test.rb | 26 | ||||
-rw-r--r-- | activerecord/test/cases/inclusion_test.rb | 9 |
3 files changed, 36 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods/read_test.rb b/activerecord/test/cases/attribute_methods/read_test.rb index 0df9ffc0c5..375c207d20 100644 --- a/activerecord/test/cases/attribute_methods/read_test.rb +++ b/activerecord/test/cases/attribute_methods/read_test.rb @@ -18,6 +18,7 @@ module ActiveRecord def self.active_record_super; Base; end def self.base_class; self; end + include ActiveRecord::Configuration include ActiveRecord::AttributeMethods def self.column_names 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 diff --git a/activerecord/test/cases/inclusion_test.rb b/activerecord/test/cases/inclusion_test.rb index d092e748e8..ee32a71ca9 100644 --- a/activerecord/test/cases/inclusion_test.rb +++ b/activerecord/test/cases/inclusion_test.rb @@ -41,4 +41,13 @@ class InclusionUnitTest < ActiveRecord::TestCase def test_connection_handler assert_equal ActiveRecord::Base.connection_handler, @klass.connection_handler end + + def test_mirrored_configuration + ActiveRecord::Base.time_zone_aware_attributes = true + assert @klass.time_zone_aware_attributes + ActiveRecord::Base.time_zone_aware_attributes = false + assert !@klass.time_zone_aware_attributes + ensure + ActiveRecord::Base.time_zone_aware_attributes = false + end end |