From 154b7ffd976ba741fd56b1a45c35112a8a566fcd Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 13 Sep 2019 18:06:37 +0900 Subject: [PATCH] Tests for OptionMerger with keyword arguments --- activesupport/test/option_merger_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/activesupport/test/option_merger_test.rb b/activesupport/test/option_merger_test.rb index 935e2aee63..1a1cb711dc 100644 --- a/activesupport/test/option_merger_test.rb +++ b/activesupport/test/option_merger_test.rb @@ -15,6 +15,8 @@ class OptionMergerTest < ActiveSupport::TestCase assert_equal local_options, method_with_options(local_options) assert_equal @options.merge(local_options), o.method_with_options(local_options) + assert_equal @options.merge(local_options), o.method_with_kwargs(local_options) + assert_equal @options.merge(local_options), o.method_with_kwargs_only(local_options) end end @@ -22,6 +24,8 @@ class OptionMergerTest < ActiveSupport::TestCase with_options(@options) do |o| assert_equal Hash.new, method_with_options assert_equal @options, o.method_with_options + assert_equal @options, o.method_with_kwargs + assert_equal @options, o.method_with_kwargs_only end end @@ -94,4 +98,12 @@ class OptionMergerTest < ActiveSupport::TestCase def method_with_options(options = {}) options end + + def method_with_kwargs(*args, **options) + options + end + + def method_with_kwargs_only(**options) + options + end end