From ab52c5ab50ec4b9dc4e14f9253cdaf7545685cb0 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 8 Apr 2020 16:07:07 +0100 Subject: [PATCH] Merge pull request #2718 from rspec/remove-klass-exec-in-favour-of-rspec-support-class-exec Use shared class_exec fallback from rspec-support --- lib/rspec/core/shared_example_group.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rspec/core/shared_example_group.rb b/lib/rspec/core/shared_example_group.rb index b6ced2cc1f..3d9efce282 100644 --- a/lib/rspec/core/shared_example_group.rb +++ b/lib/rspec/core/shared_example_group.rb @@ -1,3 +1,5 @@ +RSpec::Support.require_rspec_support "with_keywords_when_needed" + module RSpec module Core # Represents some functionality that is shared with multiple example groups. @@ -33,7 +35,7 @@ def include_in(klass, inclusion_line, args, customization_block) klass.update_inherited_metadata(@metadata) unless @metadata.empty? SharedExampleGroupInclusionStackFrame.with_frame(@description, inclusion_line) do - klass.class_exec(*args, &@definition) + RSpec::Support::WithKeywordsWhenNeeded.class_exec(klass, *args, &@definition) klass.class_exec(&customization_block) if customization_block end end