From 29b2dd936d028e401aebf4cc70412ced67e995fe Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Sun, 14 Jul 2024 10:56:29 -0700 Subject: [PATCH] Forward kwargs correctly for calls in context --- lib/shoulda/context/context.rb | 4 ++-- test/shoulda/context_test.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index f5e1888e..0e199628 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -216,8 +216,8 @@ def test_name_prefix end end - def method_missing(method, *args, &blk) - test_unit_class.send(method, *args, &blk) + def method_missing(...) + test_unit_class.send(...) end end diff --git a/test/shoulda/context_test.rb b/test/shoulda/context_test.rb index 61036e93..edcc24c2 100644 --- a/test/shoulda/context_test.rb +++ b/test/shoulda/context_test.rb @@ -1,8 +1,8 @@ require 'test_helper' class ContextTest < PARENT_TEST_CASE - def self.context_macro(&blk) - context "with a subcontext made by a macro" do + def self.context_macro(type:, &blk) + context "with a #{type.inspect} subcontext made by a macro" do setup { @context_macro = :foo } merge_block(&blk) @@ -36,9 +36,9 @@ def self.context_macro(&blk) end end - context_macro do + context_macro type: :test do should "have name set right" do - assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, normalized_name) + assert_match(/^test: context with setup block with a :type subcontext made by a macro should have name set right/, normalized_name) end should "run the setup block of that context macro" do