Tests for OptionMerger with keyword arguments

This commit is contained in:
Akira Matsuda 2019-09-13 18:06:37 +09:00
parent 926cfdb4e3
commit 154b7ffd97
1 changed files with 12 additions and 0 deletions

View File

@ -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