From 59b524c7735866da7ade7372be39be3a5e7bc96c Mon Sep 17 00:00:00 2001 From: Akshay Birajdar Date: Thu, 12 Sep 2024 02:02:09 +0530 Subject: [PATCH 1/2] docs: Add example of proc being acceptable as filter in config.include --- lib/rspec/core/configuration.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rspec/core/configuration.rb b/lib/rspec/core/configuration.rb index 18e4bef0b..0bf5bf475 100644 --- a/lib/rspec/core/configuration.rb +++ b/lib/rspec/core/configuration.rb @@ -1409,6 +1409,9 @@ def exclusion_filter # # # included in examples with `:type => :request` metadata # config.include(AuthenticationHelpers, :type => :request) + # + # # included in examples where the `:type` metadata matches a proc condition + # config.include(AuthenticationHelpers, :type => ->(type, _metadata) { [:request, :controller].include?(type) }) # end # # describe "edit profile", :preferences, :type => :request do From 86a12b73ba61bd6a5cc097d6ca7ad89c387aa0fc Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 11 Sep 2024 21:54:20 +0100 Subject: [PATCH 2/2] Use proc --- lib/rspec/core/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/core/configuration.rb b/lib/rspec/core/configuration.rb index 0bf5bf475..641a1cc78 100644 --- a/lib/rspec/core/configuration.rb +++ b/lib/rspec/core/configuration.rb @@ -1411,7 +1411,7 @@ def exclusion_filter # config.include(AuthenticationHelpers, :type => :request) # # # included in examples where the `:type` metadata matches a proc condition - # config.include(AuthenticationHelpers, :type => ->(type, _metadata) { [:request, :controller].include?(type) }) + # config.include(AuthenticationHelpers, :type => proc { |type, _metadata| [:request, :controller].include?(type) }) # end # # describe "edit profile", :preferences, :type => :request do