17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/uspec/harness.rb', line 17
def spec_eval description, &block
state = 0
print ' -- ', description
if block then
begin
state = 1
raw_result = Uspec::Spec.new(self, description, &block).__uspec_block
state = 2
rescue Exception => raw_result
state = 3
end
end
result = Uspec::Result.new description, raw_result, caller
unless block then
state = 4
result.pending!
end
stats << result
print ': ', result.pretty, "\n"
rescue => error
state = 5
message = <<-MSG
#{error.class} : #{error.message}
Uspec encountered an internal error, please report this bug: https://github.com/acook/uspec/issues/new
\t#{error.backtrace.join "\n\t"}
MSG
puts
warn message
stats << Uspec::Result.new(message, error, caller)
ensure
cli.handle_interrupt! result.raw
return [state, error, result, raw_result]
end
|