rubytest-html 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/.index +45 -0
  3. data/LICENSE.txt +23 -0
  4. data/README.md +10 -0
  5. data/lib/rubytest/format/html.rb +155 -0
  6. metadata +65 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d1f235b9c234da985d4b2a74729b073e7b143251
4
+ data.tar.gz: ac2926bfc78967883a925e9731759c6cf650d8c7
5
+ SHA512:
6
+ metadata.gz: d8bec470d5e270b544b99c7b0cc7da60b2ee245da82834616578b2bdcfe02f527abaac89db26427d2f72a7c0c1fa27f4f11d6307e6312add36b6900c20d286d9
7
+ data.tar.gz: eec3182cb4fcb6fed7bfd5ef1b4bcd11914417aa1df25aa1a53fa69297da18161044bf02b10d43036ac460427d14de48ba3fd794ee228ff1c4487ea17d7f7d5b
data/.index ADDED
@@ -0,0 +1,45 @@
1
+ ---
2
+ revision: 2013
3
+ type: ruby
4
+ sources:
5
+ - Indexfile
6
+ - Gemfile
7
+ authors:
8
+ - name: trans
9
+ email: transfire@gmail.com
10
+ organizations: []
11
+ requirements:
12
+ - version: '>= 0.8.0'
13
+ name: rubytest
14
+ conflicts: []
15
+ alternatives: []
16
+ resources:
17
+ - type: home
18
+ uri: http://rubyworks.github.com/rubytest-html
19
+ label: Homepage
20
+ - type: code
21
+ uri: http://github.com/rubyworks/rubytest-html
22
+ label: Source Code
23
+ - type: mail
24
+ uri: http://groups.google.com/group/rubyworks-mailinglist
25
+ label: Mailing List
26
+ repositories:
27
+ - name: upstream
28
+ scm: git
29
+ uri: git@github.com:rubyworks/rubytest-html.git
30
+ categories: []
31
+ copyrights:
32
+ - holder: RubyWorks
33
+ year: '2011'
34
+ license: BSD-2-Clause
35
+ customs: []
36
+ paths:
37
+ lib:
38
+ - lib
39
+ name: rubytest-html
40
+ title: HTML Test Reporter
41
+ version: 0.1.0
42
+ summary: HTML format for Rubytest
43
+ description: This is an HTML test report format for the Rubytest metaframework.
44
+ created: '2011-07-23'
45
+ date: '2014-07-18'
@@ -0,0 +1,23 @@
1
+ (BSD-2-Clause License)
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
14
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
16
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
17
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
20
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
@@ -0,0 +1,10 @@
1
+ # HTML Test Reporter
2
+
3
+ This is test report format plugin for Rubytest.
4
+
5
+
6
+ ## Copyrights
7
+
8
+ Copyright 2011 Rubyworks. All rights reserved.
9
+
10
+
@@ -0,0 +1,155 @@
1
+ # encoding: UTF-8
2
+
3
+ module Test::Reporters
4
+
5
+ # HTML Test Reporter
6
+ #
7
+ # This reporter is rather simplistic and rough at this point --in need
8
+ # of some TLC. Also, it may move to the TAPOUT project rather than be
9
+ # a built-in Ruby-Test reporter.
10
+ #--
11
+ # TODO: Make this more like a microformat and add timer info.
12
+ #++
13
+ class Html < Abstract
14
+
15
+ #
16
+ def begin_suite(suite)
17
+ timer_reset
18
+
19
+ @html = []
20
+ @html << %[<html>]
21
+ @html << %[<head>]
22
+ @html << %[<title>Test Report</title>]
23
+ @html << %[ <style>]
24
+ @html << %[ html{ background: #fff; margin: 0; padding: 0; font-family: helvetica; }]
25
+ @html << %[ body{ margin: 0; padding: 0;}]
26
+ @html << %[ h3{color:#555;}]
27
+ @html << %[ #main{ margin: 0 auto; color: #110; width: 600px; ]
28
+ @html << %[ border-right: 1px solid #ddd; border-left: 1px solid #ddd; ]
29
+ @html << %[ padding: 10px 30px; width: 500px; } ]
30
+ @html << %[ .lemon{ color: gold; font-size: 22px; font-weight: bold; ]
31
+ @html << %[ font-family: courier; margin-bottom: -15px;}]
32
+ @html << %[ .tally{ font-weight: bold; margin-bottom: 10px; }]
33
+ @html << %[ .omit{ color: cyan; }]
34
+ @html << %[ .pass{ color: green; }]
35
+ @html << %[ .fail{ color: red; }]
36
+ @html << %[ .footer{ font-size: 0.7em; color: #666; margin: 20px 0; }]
37
+ @html << %[ </style>]
38
+ @html << %[</head>]
39
+ @html << %[<body>]
40
+ @html << %[<div id="main">]
41
+ @html << %[<div class="lemon">R U B Y - T E S T</div>]
42
+ @html << %[<h1>Test Report</h1>]
43
+ @body = []
44
+ end
45
+
46
+ #
47
+ def begin_case(tc)
48
+ lines = tc.to_s.split("\n")
49
+ title = lines.shift
50
+ @body << "<h2>"
51
+ @body << title
52
+ @body << "</h2>"
53
+ @body << "<div>"
54
+ @body << lines.join("<br/>")
55
+ @body << "</div>"
56
+ end
57
+
58
+ #
59
+ def begin_test(test)
60
+ if test.respond_to?(:topic)
61
+ topic = test.topic
62
+ if @topic != topic
63
+ @topic = topic
64
+ @body << "<h3>"
65
+ @body << "#{topic}"
66
+ @body << "</h3>"
67
+ end
68
+ end
69
+ end
70
+
71
+ #
72
+ def pass(test)
73
+ @body << %[<li class="pass">]
74
+ @body << "%s %s" % ["PASS", test.to_s]
75
+ @body << %[</li>]
76
+ end
77
+
78
+ #
79
+ def fail(test, exception)
80
+ @body << %[<li class="fail">]
81
+ @body << "%s %s" % ["FAIL", test.to_s]
82
+ @body << "<pre>"
83
+ @body << " FAIL #{clean_backtrace(exception)[0]}"
84
+ @body << " #{exception}"
85
+ @body << "</pre>"
86
+ @body << %[</li>]
87
+ end
88
+
89
+ #
90
+ def error(test, exception)
91
+ @body << %[<li class="error">]
92
+ @body << "%s %s" % ["ERROR", test.to_s]
93
+ @body << "<pre>"
94
+ @body << " ERROR #{exception.class}"
95
+ @body << " #{exception}"
96
+ @body << " " + clean_backtrace(exception).join("\n ")
97
+ @body << "</pre>"
98
+ @body << %[</li>]
99
+ end
100
+
101
+ #
102
+ def todo(test, exception)
103
+ @body << %[<li class="pending">]
104
+ @body << "%s %s" % ["PENDING", test.to_s]
105
+ @body << %[</li>]
106
+ end
107
+
108
+ #
109
+ def omit(test, exception)
110
+ @body << %[<li class="omit">]
111
+ @body << "%s %s" % ["OMIT", test.to_s]
112
+ @body << %[</li>]
113
+ end
114
+
115
+ #
116
+ def end_suite(suite)
117
+ @html << ""
118
+ @html << %[<div class="tally">]
119
+ @html << tally
120
+ @html << %[</div>]
121
+ @html << ""
122
+
123
+ @body << ""
124
+ @body << %[<div class="footer">]
125
+ @body << %[Generated by <a href="http://rubyworks.github.com/test">Lemon</a>]
126
+ @body << %[on #{Time.now}.]
127
+ @body << %[</div>]
128
+ @body << ""
129
+ @body << %[</div>]
130
+ @body << %[</div>]
131
+ @body << ""
132
+ @body << %[</body>]
133
+ @body << %[</html>]
134
+
135
+ puts @html.join("\n")
136
+ puts @body.join("\n")
137
+ end
138
+
139
+ private
140
+
141
+ #
142
+ def timer
143
+ secs = Time.now - @time
144
+ @time = Time.now
145
+ return "%0.5fs" % [secs.to_s]
146
+ end
147
+
148
+ #
149
+ def timer_reset
150
+ @time = Time.now
151
+ end
152
+
153
+ end
154
+
155
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubytest-html
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - trans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubytest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.0
27
+ description: This is an HTML test report format for the Rubytest metaframework.
28
+ email:
29
+ - transfire@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files:
33
+ - LICENSE.txt
34
+ - README.md
35
+ files:
36
+ - .index
37
+ - lib/rubytest/format/html.rb
38
+ - README.md
39
+ - LICENSE.txt
40
+ homepage: http://rubyworks.github.com/rubytest-html
41
+ licenses:
42
+ - BSD-2-Clause
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 2.0.3
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: HTML format for Rubytest
64
+ test_files: []
65
+ has_rdoc: