Class: Ape::HtmlReporter
- Inherits:
-
Reporter
- Object
- Erubis::Context
- Reporter
- Ape::HtmlReporter
show all
- Defined in:
- lib/ape/reporters/html_reporter.rb
Instance Attribute Summary
Attributes inherited from Reporter
#debug, #dialogs, #dianum, #diarefs, #footer, #header, #options, #server
Instance Method Summary
collapse
Methods inherited from Reporter
#add, #error, #errors, #info, #infos, instance, #line, #list_item, #save_dialog, #security_warning, #show_crumbs, #show_message, #start_list, #steps, #success, #successes, supported_outputs, #warning, #warnings
Methods included from Util
extended, included
Instance Method Details
#mark(mark) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/ape/reporters/html_reporter.rb', line 15
def mark(mark)
span = "<span class=\"#{mark.to_s}\">"
case mark
when :success
span << '✓' << '</span>'
when :warning
span << '?' << '</span>'
when :error
span << '!' << '</span>'
when :info
span = "<img class=\"info\" src=\"#{static_dir + '/info.png'}\"/>"
end
end
|
#report(output = STDOUT) ⇒ Object
49
50
51
|
# File 'lib/ape/reporters/html_reporter.rb', line 49
def report(output = STDOUT)
output.puts evaluate_template("reporters/html_template.eruby")
end
|
#report_li(step, dialog = nil, marker = nil) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/ape/reporters/html_reporter.rb', line 29
def report_li(step, dialog = nil, marker = nil)
html = '<li>'
if marker
html += "#{mark(marker)} "
end
lines = step.split("\n")
lines[0 .. -2].each do |line|
html += "#{line} <br/>"
end
html += lines[-1] if lines[-1]
if dialog
html += "<a class=\"diaref\" href=\"#dia-#{@dianum}\">[Dialog]</a>"
@diarefs[dialog] = @dianum
@dianum += 1
end
html += '</li>'
html
end
|
#static_dir ⇒ Object
5
6
7
8
9
|
# File 'lib/ape/reporters/html_reporter.rb', line 5
def static_dir
dir = (server != true)?File.expand_path(File.dirname(__FILE__) + '/../../..') : ''
dir += options[:static_path] || "/web"
dir
end
|
#stylesheet ⇒ Object
11
12
13
|
# File 'lib/ape/reporters/html_reporter.rb', line 11
def stylesheet
static_dir + '/ape.css'
end
|