File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ class << matcher
184
184
if ex . is_a? Module
185
185
error . is_a? ex
186
186
else
187
- error . class . to_s == ex . to_s
187
+ Object . const_defined? ( ex . to_s ) && error . is_a? ( Object . const_get ( ex . to_s ) )
188
188
end
189
189
end
190
190
end
Original file line number Diff line number Diff line change 32
32
33
33
it { expect ( times_called ) . to eq ( 3 ) }
34
34
end
35
+
36
+ context 'and this is passed as a string custom exception' do
37
+ let ( :options ) { [ { exceptions : 'StandardError' } ] }
38
+
39
+ it { expect ( times_called ) . to eq ( 3 ) }
40
+ end
41
+
42
+ context 'and a non-existent string custom exception is passed' do
43
+ let ( :options ) { [ { exceptions : 'WrongStandardErrorNotExisting' } ] }
44
+
45
+ it { expect ( times_called ) . to eq ( 1 ) }
46
+ end
35
47
end
36
48
37
49
context 'when an expected error happens' do
You can’t perform that action at this time.
0 commit comments