From 157aa2cd304af6551de11360e8ed2c29fabed86e Mon Sep 17 00:00:00 2001 From: Eric Mueller Date: Wed, 8 May 2024 10:47:32 -0400 Subject: [PATCH] Handle Regexp like String when apportioning args If the first argument is a Regexp, it's a message _matcher_, rather than a message.. but certainly it's not an exception! I'm actually a bit surprised this doesn't cause any other problems, but it doesn't seem to. --- lib/rspec/matchers/built_in/raise_error.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/matchers/built_in/raise_error.rb b/lib/rspec/matchers/built_in/raise_error.rb index 162fe056d..1422f1fe6 100644 --- a/lib/rspec/matchers/built_in/raise_error.rb +++ b/lib/rspec/matchers/built_in/raise_error.rb @@ -25,7 +25,7 @@ def initialize(expected_error_or_message, expected_message, &block) when nil, UndefinedValue @expected_error = Exception @expected_message = expected_message - when String + when String, Regexp @expected_error = Exception @expected_message = expected_error_or_message else