@@ -34,6 +34,8 @@ def run_test(name, skip, runner, &)
3434 instance = new ( name , skip , runner , matchers )
3535 instance . instance_exec ( &)
3636 instance . resolve
37+ rescue Exception => error
38+ runner . error! ( name , error )
3739 end
3840 end
3941
@@ -74,37 +76,37 @@ def resolve
7476
7577 def assert ( value )
7678 if value
77- success!
79+ success! ( depth : 1 )
7880 elsif block_given?
79- failure! { yield ( value ) }
81+ failure! ( depth : 1 ) { yield ( value ) }
8082 else
81- failure! { "expected #{ value . inspect } to be truthy" }
83+ failure! ( depth : 1 ) { "expected #{ value . inspect } to be truthy" }
8284 end
8385 end
8486
8587 def refute ( value )
8688 if !value
87- success!
89+ success! ( depth : 1 )
8890 elsif block_given?
89- failure! { yield ( value ) }
91+ failure! ( depth : 1 ) { yield ( value ) }
9092 else
91- failure! { "expected #{ value . inspect } to be falsy" }
93+ failure! ( depth : 1 ) { "expected #{ value . inspect } to be falsy" }
9294 end
9395 end
9496
95- def success!
97+ def success! ( depth : )
9698 if @skip
97- @runner . failure! { "The skipped test `#{ @name } ` started passing." }
99+ @runner . failure! ( @name , depth : ) { "The skipped test `#{ @name } ` started passing." }
98100 else
99- @runner . success! ( @name )
101+ @runner . success! ( @name , depth : )
100102 end
101103 end
102104
103- def failure! ( &)
105+ def failure! ( depth : , &)
104106 if @skip
105- @runner . success! ( @name )
107+ @runner . success! ( @name , depth : )
106108 else
107- @runner . failure! ( &)
109+ @runner . failure! ( @name , depth : , &)
108110 end
109111 end
110112end
0 commit comments