File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -661,7 +661,9 @@ def actual_for_diff
661661
662662 def expected_for_matcher_text
663663 if @expected_message
664- "#<#{ @expected_error . name } #{ @expected_message . inspect } >"
664+ "#<#{ @expected_error . name } #{ description_of ( @expected_message ) } >"
665+ elsif @expected_error . is_a? Regexp
666+ "#<Exception #{ description_of ( @expected_error ) } >"
665667 else
666668 "#<#{ @expected_error . name } >"
667669 end
Original file line number Diff line number Diff line change 1818 end
1919 end
2020
21+ context "with regular expression as message (and assuming a RuntimeError)" do
22+ it "returns the correct output" do
23+ expect ( raise_error ( /hell/ ) . description ) . to eq (
24+ %|raise error #<Exception /hell/>| ,
25+ )
26+ end
27+ end
28+
2129 context "with both an exception and a message" do
2230 it "returns the correct output" do
2331 expect ( raise_error ( RuntimeError , "hell" ) . description ) . to eq (
2432 %|raise error #<RuntimeError "hell">| ,
2533 )
2634 end
2735 end
36+
37+ context "with an exception and a regular expression as message" do
38+ it "returns the correct output" do
39+ expect ( raise_error ( RuntimeError , /hell/ ) . description ) . to eq (
40+ %|raise error #<RuntimeError /hell/>| ,
41+ )
42+ end
43+ end
2844 end
2945end
You can’t perform that action at this time.
0 commit comments