Class: RSpec::Core::Formatters::HtmlPrinter
- Inherits:
-
Object
- Object
- RSpec::Core::Formatters::HtmlPrinter
show all
- Includes:
- ERB::Util
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb
Constant Summary
Constants included
from ERB::Util
ERB::Util::HTML_ESCAPE, ERB::Util::HTML_ESCAPE_ONCE_REGEXP, ERB::Util::JSON_ESCAPE, ERB::Util::JSON_ESCAPE_REGEXP, ERB::Util::TAG_NAME_FOLLOWING_REGEXP, ERB::Util::TAG_NAME_REPLACEMENT_CHAR, ERB::Util::TAG_NAME_START_REGEXP, ERB::Util::TAG_NAME_START_REGEXP_SET
Instance Method Summary
collapse
-
#flush ⇒ Object
-
#initialize(output) ⇒ HtmlPrinter
constructor
A new instance of HtmlPrinter.
-
#make_example_group_header_red(group_id) ⇒ Object
-
#make_example_group_header_yellow(group_id) ⇒ Object
-
#make_header_red ⇒ Object
-
#make_header_yellow ⇒ Object
-
#move_progress(percent_done) ⇒ Object
-
#print_example_failed(pending_fixed, description, run_time, failure_id, exception, extra_content) ⇒ Object
-
#print_example_group_end ⇒ Object
-
#print_example_group_start(group_id, description, number_of_parents) ⇒ Object
-
#print_example_passed(description, run_time) ⇒ Object
-
#print_example_pending(description, pending_message) ⇒ Object
-
#print_html_start ⇒ Object
-
#print_summary(duration, example_count, failure_count, pending_count) ⇒ Object
Methods included from ERB::Util
h, html_escape, html_escape_once, json_escape, unwrapped_html_escape, xml_name_escape
Constructor Details
Returns a new instance of HtmlPrinter.
9
10
11
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 9
def initialize(output)
@output = output
end
|
Instance Method Details
79
80
81
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 79
def flush
@output.flush
end
|
96
97
98
99
100
101
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 96
def (group_id)
@output.puts " <script type=\"text/javascript\">" \
"makeRed('div_group_#{group_id}');</script>"
@output.puts " <script type=\"text/javascript\">" \
"makeRed('example_group_#{group_id}');</script>"
end
|
103
104
105
106
107
108
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 103
def (group_id)
@output.puts " <script type=\"text/javascript\">" \
"makeYellow('div_group_#{group_id}');</script>"
@output.puts " <script type=\"text/javascript\">" \
"makeYellow('example_group_#{group_id}');</script>"
end
|
88
89
90
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 88
def
@output.puts " <script type=\"text/javascript\">makeRed('rspec-header');</script>"
end
|
92
93
94
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 92
def
@output.puts " <script type=\"text/javascript\">makeYellow('rspec-header');</script>"
end
|
#move_progress(percent_done) ⇒ Object
83
84
85
86
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 83
def move_progress(percent_done)
@output.puts " <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
@output.flush
end
|
#print_example_failed(pending_fixed, description, run_time, failure_id, exception, extra_content) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 36
def print_example_failed(pending_fixed, description, run_time, failure_id,
exception, )
formatted_run_time = "%.5f" % run_time
@output.puts " <dd class=\"example #{pending_fixed ? 'pending_fixed' : 'failed'}\">"
@output.puts " <span class=\"failed_spec_name\">#{h(description)}</span>"
@output.puts " <span class=\"duration\">#{formatted_run_time}s</span>"
@output.puts " <div class=\"failure\" id=\"failure_#{failure_id}\">"
if exception
@output.puts " <div class=\"message\"><pre>#{h(exception[:message])}</pre></div>"
@output.puts " <div class=\"backtrace\"><pre>#{h exception[:backtrace]}</pre></div>"
end
@output.puts if
@output.puts " </div>"
@output.puts " </dd>"
end
|
#print_example_group_end ⇒ Object
18
19
20
21
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 18
def print_example_group_end
@output.puts " </dl>"
@output.puts "</div>"
end
|
#print_example_group_start(group_id, description, number_of_parents) ⇒ Object
23
24
25
26
27
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 23
def print_example_group_start(group_id, description, number_of_parents)
@output.puts "<div id=\"div_group_#{group_id}\" class=\"example_group passed\">"
@output.puts " <dl #{indentation_style(number_of_parents)}>"
@output.puts " <dt id=\"example_group_#{group_id}\" class=\"passed\">#{h(description)}</dt>"
end
|
#print_example_passed(description, run_time) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 29
def print_example_passed(description, run_time)
formatted_run_time = "%.5f" % run_time
@output.puts " <dd class=\"example passed\">" \
"<span class=\"passed_spec_name\">#{h(description)}</span>" \
"<span class='duration'>#{formatted_run_time}s</span></dd>"
end
|
#print_example_pending(description, pending_message) ⇒ Object
53
54
55
56
57
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 53
def print_example_pending(description, pending_message)
@output.puts " <dd class=\"example not_implemented\">" \
"<span class=\"not_implemented_spec_name\">#{h(description)} " \
"(PENDING: #{h(pending_message)})</span></dd>"
end
|
#print_html_start ⇒ Object
13
14
15
16
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 13
def print_html_start
@output.puts HTML_HEADER
@output.puts REPORT_HEADER
end
|
#print_summary(duration, example_count, failure_count, pending_count) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb', line 59
def print_summary(duration, example_count, failure_count, pending_count)
totals = String.new(
"#{example_count} example#{'s' unless example_count == 1}, "
)
totals << "#{failure_count} failure#{'s' unless failure_count == 1}"
totals << ", #{pending_count} pending" if pending_count > 0
formatted_duration = "%.5f" % duration
@output.puts "<script type=\"text/javascript\">" \
"document.getElementById('duration').innerHTML = \"Finished in " \
"<strong>#{formatted_duration} seconds</strong>\";</script>"
@output.puts "<script type=\"text/javascript\">" \
"document.getElementById('totals').innerHTML = \"#{totals}\";</script>"
@output.puts "</div>"
@output.puts "</div>"
@output.puts "</body>"
@output.puts "</html>"
end
|