From 4189ed800b4990e610878c1a22e3123ad1e85405 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 29 Aug 2024 05:45:52 +0900 Subject: [PATCH] Install RSpecMatcherProxies via Object#extend as well Because that's how Cucumber world module mixes-in Capybara::DSL https://github.com/cucumber/cucumber-ruby/blob/v9.2.0/lib/cucumber/glue/proto_world.rb#L176 fixes #2761 --- lib/capybara/rspec/matcher_proxies.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/capybara/rspec/matcher_proxies.rb b/lib/capybara/rspec/matcher_proxies.rb index e576a357b..2f2e08080 100644 --- a/lib/capybara/rspec/matcher_proxies.rb +++ b/lib/capybara/rspec/matcher_proxies.rb @@ -52,6 +52,11 @@ def included(base) base.include(::Capybara::RSpecMatcherProxies) if defined?(::RSpec::Matchers) && base.include?(::RSpec::Matchers) super end + + def extended(base) + base.extend(::Capybara::RSpecMatcherProxies) if defined?(::RSpec::Matchers) && base.is_a?(::RSpec::Matchers) + super + end end def self.prepended(base)