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
|
# File 'lib/uspec/dsl.rb', line 17
def spec description
print ' -- ', description
if block_given? then
begin
raw_result = yield
rescue Exception => raw_result
end
end
result = Result.new description, raw_result, caller
unless block_given? then
result.pending!
end
if result.success?
__uspec_stats.success << result
elsif result.pending?
stats.pending << result
else
__uspec_stats.failure << result
end
print ': ', result.pretty, "\n"
rescue => error
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
__uspec_stats.failure << Uspec::Result.new(message, error, caller)
end
|