jahtml_formatter 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format JahtmlFormatter
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+ gemspec
3
+ gem 'rake'
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Martin Westin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # JahtmlFormatter
2
+
3
+ JahtmlFormatter tweakes the CSS of the Rspec HtmlFormatter to make it better for ME to print to pdf and include in V&V Reports. Fun stuff. It it probably not very useful or interesting to anyone else.
4
+
5
+
6
+ ## Installation
7
+
8
+ $ bundle exec rspec --format JahtmlFormatter -o spec_output.html
9
+
10
+ To use JahtmlFormatter by default, put the options in a .rspec file:
11
+
12
+ --format JahtmlFormatter
13
+ -o spec_output.html
14
+
15
+
16
+ ## Contributing
17
+
18
+ This is likely not very interesting to contribute to either. :)
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "jahtml_formatter"
5
+ s.version = '1.0.0'
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["Martin Westin"]
8
+ s.email = ["martin@eimermusic.com"]
9
+ s.homepage = "https://github.com/eimermusic/jahtml_formatter"
10
+ s.summary = %q{Tweaked rspec html formatter. More suitable for pdf generation.}
11
+ s.description = %q{Tweaked rspec html formatter. More suitable for pdf generation. At least for me.}
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+
18
+ s.add_dependency('rspec', ["~> 2.0"])
19
+ end
@@ -0,0 +1,231 @@
1
+ require 'erb'
2
+ require 'rspec/core/formatters/html_formatter'
3
+
4
+ class JahtmlFormatter < RSpec::Core::Formatters::HtmlFormatter
5
+
6
+ def html_header
7
+ <<-EOF
8
+ <?xml version="1.0" encoding="UTF-8"?>
9
+ <!DOCTYPE html
10
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
11
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>RSpec results</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
+ <meta http-equiv="Expires" content="-1" />
17
+ <meta http-equiv="Pragma" content="no-cache" />
18
+ <style type="text/css">
19
+ body {
20
+ margin: 0;
21
+ padding: 0;
22
+ background: #fff;
23
+ font-size: 80%;
24
+ }
25
+ </style>
26
+ <script type="text/javascript">
27
+ // <![CDATA[
28
+ #{global_scripts}
29
+ // ]]>
30
+ </script>
31
+ <style type="text/css">
32
+ #{global_styles}
33
+ </style>
34
+ </head>
35
+ <body>
36
+ EOF
37
+ end
38
+
39
+ def report_header
40
+ <<-EOF
41
+ <div class="rspec-report">
42
+
43
+ <div id="rspec-header">
44
+ <div id="label">
45
+ <h1>Automated Software Test Report</h1>
46
+ </div>
47
+
48
+ <div id="summary">
49
+ <p id="totals">&nbsp;</p>
50
+ <p id="duration">&nbsp;</p>
51
+ </div>
52
+ </div>
53
+
54
+
55
+ <div class="results">
56
+ EOF
57
+ end
58
+
59
+ def global_styles
60
+ <<-EOF
61
+ #rspec-header {
62
+ color: #000; height: 4em; border-top: 1em solid #65C400;
63
+ }
64
+
65
+ .rspec-report h1 {
66
+ margin: 0px 10px 0px 10px;
67
+ padding: 10px;
68
+ font-family: "Lucida Grande", Helvetica, sans-serif;
69
+ font-size: 1.8em;
70
+ position: absolute;
71
+ }
72
+
73
+ #label {
74
+ float:left;
75
+ }
76
+
77
+ #display-filters {
78
+ float:left;
79
+ padding: 28px 0 0 40%;
80
+ font-family: "Lucida Grande", Helvetica, sans-serif;
81
+ }
82
+
83
+ #summary {
84
+ float:right;
85
+ padding: 5px 10px;
86
+ font-family: "Lucida Grande", Helvetica, sans-serif;
87
+ text-align: right;
88
+ }
89
+
90
+ #summary p {
91
+ margin: 0 0 0 2px;
92
+ }
93
+
94
+ #summary #totals {
95
+ font-size: 1.2em;
96
+ }
97
+
98
+ .example_group {
99
+ margin: 0 10px 5px;
100
+ background: #fff;
101
+ }
102
+
103
+ dl {
104
+ margin: 0; padding: 0 0 5px;
105
+ font: normal 11px "Lucida Grande", Helvetica, sans-serif;
106
+ }
107
+
108
+ dt {
109
+ color: #000;
110
+ font-weight: bold;
111
+ padding:3px;
112
+ }
113
+
114
+ dd {
115
+ margin: 5px 0 5px 5px;
116
+ padding: 3px 3px 3px 18px;
117
+ }
118
+
119
+ dd .duration {
120
+ padding-left: 5px;
121
+ text-align: right;
122
+ right: 0px;
123
+ float:right;
124
+ }
125
+
126
+ dd.example.passed {
127
+ border-left: 5px solid #65C400;
128
+ border-bottom: 1px solid #65C400;
129
+ color: #000;
130
+ }
131
+
132
+ dd.example.not_implemented {
133
+ border-left: 5px solid #FAF834;
134
+ border-bottom: 1px solid #FAF834;
135
+ color: #000;
136
+ }
137
+
138
+ dd.example.pending_fixed {
139
+ border-left: 5px solid #0000C2;
140
+ border-bottom: 1px solid #0000C2;
141
+ color: #000;
142
+ }
143
+
144
+ dd.example.failed {
145
+ border-left: 5px solid #C20000;
146
+ border-bottom: 1px solid #C20000;
147
+ color: #000;
148
+ }
149
+
150
+ dd.example.passed:after {
151
+ content: " PASSED, ";
152
+ float:right;
153
+ white-space: nowrap;
154
+ border-left: 1em solid #65C400;
155
+ padding-left: .5em;
156
+ }
157
+
158
+
159
+ dt.not_implemented {
160
+ color: #000000; background: #FAF834;
161
+ }
162
+
163
+ dt.pending_fixed {
164
+ color: #FFFFFF; background: #C40D0D;
165
+ }
166
+
167
+ dt.failed {
168
+ border-left: 5px solid #C20000;
169
+ }
170
+
171
+
172
+ #rspec-header.not_implemented {
173
+ border-top: 1em solid #FAF834;
174
+ }
175
+
176
+ #rspec-header.pending_fixed {
177
+ border-top: 1em solid #C40D0D;
178
+ }
179
+
180
+ #rspec-header.failed {
181
+ border-top: 1em solid #C40D0D;
182
+ }
183
+
184
+
185
+ .backtrace {
186
+ color: #000;
187
+ font-size: 12px;
188
+ }
189
+
190
+ a {
191
+ color: #BE5C00;
192
+ }
193
+
194
+ /* Ruby code, style similar to vibrant ink */
195
+ .ruby {
196
+ font-size: 12px;
197
+ font-family: monospace;
198
+ color: white;
199
+ background-color: black;
200
+ padding: 0.1em 0 0.2em 0;
201
+ }
202
+
203
+ .ruby .keyword { color: #FF6600; }
204
+ .ruby .constant { color: #339999; }
205
+ .ruby .attribute { color: white; }
206
+ .ruby .global { color: white; }
207
+ .ruby .module { color: white; }
208
+ .ruby .class { color: white; }
209
+ .ruby .string { color: #66FF00; }
210
+ .ruby .ident { color: white; }
211
+ .ruby .method { color: #FFCC00; }
212
+ .ruby .number { color: white; }
213
+ .ruby .char { color: white; }
214
+ .ruby .comment { color: #9933CC; }
215
+ .ruby .symbol { color: white; }
216
+ .ruby .regex { color: #44B4CC; }
217
+ .ruby .punct { color: white; }
218
+ .ruby .escape { color: white; }
219
+ .ruby .interp { color: white; }
220
+ .ruby .expr { color: white; }
221
+
222
+ .ruby .offending { background-color: gray; }
223
+ .ruby .linenum {
224
+ width: 75px;
225
+ padding: 0.1em 1em 0.2em 0;
226
+ color: #000000;
227
+ background-color: #FFFBD3;
228
+ }
229
+ EOF
230
+ end
231
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jahtml_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Martin Westin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ description: Tweaked rspec html formatter. More suitable for pdf generation. At least
31
+ for me.
32
+ email:
33
+ - martin@eimermusic.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - .rspec
40
+ - Gemfile
41
+ - LICENSE
42
+ - README.md
43
+ - jahtml_formatter.gemspec
44
+ - lib/jahtml_formatter.rb
45
+ homepage: https://github.com/eimermusic/jahtml_formatter
46
+ licenses: []
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 1.8.24
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Tweaked rspec html formatter. More suitable for pdf generation.
69
+ test_files: []