aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/class/attribute_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/class/attribute_test.rb')
-rw-r--r--activesupport/test/core_ext/class/attribute_test.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb
index 5a9ec78cc1..be6ad82367 100644
--- a/activesupport/test/core_ext/class/attribute_test.rb
+++ b/activesupport/test/core_ext/class/attribute_test.rb
@@ -1,9 +1,15 @@
+# frozen_string_literal: true
+
require "abstract_unit"
require "active_support/core_ext/class/attribute"
class ClassAttributeTest < ActiveSupport::TestCase
def setup
- @klass = Class.new { class_attribute :setting }
+ @klass = Class.new do
+ class_attribute :setting
+ class_attribute :timeout, default: 5
+ end
+
@sub = Class.new(@klass)
end
@@ -12,6 +18,10 @@ class ClassAttributeTest < ActiveSupport::TestCase
assert_nil @sub.setting
end
+ test "custom default" do
+ assert_equal 5, @klass.timeout
+ end
+
test "inheritable" do
@klass.setting = 1
assert_equal 1, @sub.setting