diff options
Diffstat (limited to 'activesupport/test/ordered_options_test.rb')
-rw-r--r-- | activesupport/test/ordered_options_test.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/activesupport/test/ordered_options_test.rb b/activesupport/test/ordered_options_test.rb index 18767a3536..2c67bb02ac 100644 --- a/activesupport/test/ordered_options_test.rb +++ b/activesupport/test/ordered_options_test.rb @@ -1,5 +1,7 @@ -require 'abstract_unit' -require 'active_support/ordered_options' +# frozen_string_literal: true + +require "abstract_unit" +require "active_support/ordered_options" class OrderedOptionsTest < ActiveSupport::TestCase def test_usage @@ -100,4 +102,17 @@ class OrderedOptionsTest < ActiveSupport::TestCase end assert_raises(KeyError) { a.non_existing_key! } end + + def test_inheritable_options_with_bang + a = ActiveSupport::InheritableOptions.new(foo: :bar) + + assert_nothing_raised { a.foo! } + assert_equal a.foo, a.foo! + + assert_raises(KeyError) do + a.foo = nil + a.foo! + end + assert_raises(KeyError) { a.non_existing_key! } + end end |