Class: Riot::Reporter
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Reporter.
5
6
7
8
|
# File 'lib/riot/reporter.rb', line 5
def initialize
@passes = @failures = @errors = 0
@current_context = ""
end
|
Instance Attribute Details
#current_context ⇒ Object
Returns the value of attribute current_context.
3
4
5
|
# File 'lib/riot/reporter.rb', line 3
def current_context
@current_context
end
|
Returns the value of attribute errors.
3
4
5
|
# File 'lib/riot/reporter.rb', line 3
def errors
@errors
end
|
Returns the value of attribute failures.
3
4
5
|
# File 'lib/riot/reporter.rb', line 3
def failures
@failures
end
|
Returns the value of attribute passes.
3
4
5
|
# File 'lib/riot/reporter.rb', line 3
def passes
@passes
end
|
Instance Method Details
#describe_context(context) ⇒ Object
21
|
# File 'lib/riot/reporter.rb', line 21
def describe_context(context); @current_context = context; end
|
#error(description, result) ⇒ Object
41
|
# File 'lib/riot/reporter.rb', line 41
def error(description, result); end
|
#fail(description, message, line, file) ⇒ Object
40
|
# File 'lib/riot/reporter.rb', line 40
def fail(description, message, line, file); end
|
#new(*args, &block) ⇒ Object
10
|
# File 'lib/riot/reporter.rb', line 10
def new(*args, &block); self; end
|
#pass(description, result) ⇒ Object
39
|
# File 'lib/riot/reporter.rb', line 39
def pass(description, result); end
|
#report(description, response) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/riot/reporter.rb', line 23
def report(description, response)
code, result = *response
case code
when :pass then
@passes += 1
pass(description, result)
when :fail then
@failures += 1
message, line, file = *response[1..-1]
fail(description, message, line, file)
when :error then
@errors += 1
error(description, result)
end
end
|
#success? ⇒ Boolean
12
|
# File 'lib/riot/reporter.rb', line 12
def success?; (@failures + @errors) == 0; end
|
#summarize(&block) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/riot/reporter.rb', line 14
def summarize(&block)
started = Time.now
yield
ensure
results(Time.now - started)
end
|