turnip_formatter 0.0.6 → 0.1.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/Guardfile CHANGED
@@ -3,3 +3,7 @@ guard 'rspec' do
3
3
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
4
  watch('spec/spec_helper.rb') { "spec" }
5
5
  end
6
+
7
+ guard 'rspec', cli: '-r ./spec/examples/spec_helper' do
8
+ watch('lib/turnip_formatter/formatter.css') { "spec/examples" }
9
+ end
data/README.md CHANGED
@@ -43,6 +43,31 @@ Run this command.
43
43
 
44
44
  $ rspec -r turnip_formatter --format RSpecTurnipFormatter --out report.html
45
45
 
46
+
47
+ Screenshot
48
+ --------------------
49
+
50
+ ### Step overview
51
+
52
+ ![Tab steps](https://github.com/gongo/turnip_formatter/raw/master/images/tab_steps.png)
53
+
54
+ expand:
55
+
56
+ ![Expand tab steps](https://github.com/gongo/turnip_formatter/raw/master/images/tab_steps_expanding.png)
57
+
58
+ ### Speed Statistics
59
+
60
+ ![Expand tab steps](https://github.com/gongo/turnip_formatter/raw/master/images/tab_speed_statistics.png)
61
+
62
+ ### Feature Statistics
63
+
64
+ ![Expand tab steps](https://github.com/gongo/turnip_formatter/raw/master/images/tab_feature_statistics.png)
65
+
66
+ ### Tag Statistics
67
+
68
+ ![Expand tab steps](https://github.com/gongo/turnip_formatter/raw/master/images/tab_tag_statistics.png)
69
+
70
+
46
71
  Example
47
72
  --------------------
48
73
 
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -10,36 +10,56 @@ module RSpec
10
10
  module Core
11
11
  module Formatters
12
12
  class TurnipFormatter < BaseFormatter
13
+ attr_reader :passed_scenarios, :failed_scenarios, :pending_scenarios
14
+ attr_reader :scenarios
13
15
 
14
16
  def initialize(output)
15
17
  super(output)
16
18
  @template = ::TurnipFormatter::Template.new
19
+ @passed_scenarios = []
20
+ @failed_scenarios = []
21
+ @pending_scenarios = []
22
+ @scenarios = []
17
23
  end
18
24
 
19
25
  def start(example_count)
20
26
  super(example_count)
21
27
  output.puts @template.print_header
28
+ output.puts @template.print_main_header
22
29
  end
23
30
 
24
31
  def dump_summary(duration, example_count, failure_count, pending_count)
25
- output.puts @template.print_footer(example_count, failure_count, pending_count, duration)
32
+ output.puts @template.print_main_footer(example_count, failure_count, pending_count, duration)
33
+ output.puts @template.print_tab_speed_statsitics(passed_scenarios)
34
+ output.puts @template.print_tab_feature_statsitics(scenarios)
35
+ output.puts @template.print_tab_tag_statsitics(scenarios)
36
+ output.puts @template.print_footer
26
37
  end
27
38
 
28
39
  def example_passed(example)
29
40
  super(example)
41
+
30
42
  scenario = ::TurnipFormatter::Scenario::Pass.new(example)
43
+ @passed_scenarios << scenario
44
+
31
45
  output_scenario(scenario)
32
46
  end
33
47
 
34
48
  def example_pending(example)
35
49
  super(example)
50
+
36
51
  scenario = ::TurnipFormatter::Scenario::Pending.new(example)
52
+ @pending_scenarios << scenario
53
+
37
54
  output_scenario(scenario)
38
55
  end
39
56
 
40
57
  def example_failed(example)
41
58
  super(example)
59
+
42
60
  scenario = ::TurnipFormatter::Scenario::Failure.new(example)
61
+ @failed_scenarios << scenario
62
+
43
63
  output_scenario(scenario)
44
64
  end
45
65
 
@@ -47,6 +67,7 @@ module RSpec
47
67
 
48
68
  def output_scenario(scenario)
49
69
  scenario.validation
70
+ @scenarios << scenario
50
71
  output.puts @template.print_scenario(scenario)
51
72
  rescue => e
52
73
  output_runtime_error(e)
@@ -2,162 +2,218 @@ body {
2
2
  background-color: #586e75; }
3
3
 
4
4
  div#report {
5
- width: 90%;
6
5
  margin: 0 auto;
7
6
  padding: 2em;
8
7
  background: black;
9
- color: #aaffaa; }
8
+ color: #509b49; }
10
9
 
11
10
  footer {
12
- width: 90%;
13
11
  margin: 0 auto;
14
12
  padding: 2em;
15
13
  background: black;
16
- color: #aaffaa;
14
+ color: #509b49;
17
15
  text-align: right; }
18
16
 
19
17
  div#main {
20
- width: 90%;
21
18
  margin: 0 auto;
22
19
  padding: 2em;
23
20
  background-color: #fff9f9; }
21
+ div#main .ui-tabs-nav {
22
+ border-width: 0;
23
+ padding: 0; }
24
+ div#main .ui-tabs-panel {
25
+ border: 1px solid #7a7b7d; }
24
26
 
25
- section.scenario {
27
+ div#steps-statistics section.scenario {
26
28
  margin: 1em 0em;
27
29
  padding-left: 1em;
28
30
  border: 2px solid green; }
29
- section.scenario > header {
31
+ div#steps-statistics section.scenario > header {
30
32
  margin: 1em 0em; }
31
- section.scenario > header:hover {
33
+ div#steps-statistics section.scenario > header:hover {
32
34
  text-decoration: underline;
33
35
  cursor: pointer; }
34
- section.scenario > header span.scenario_name {
36
+ div#steps-statistics section.scenario > header span.scenario_name {
35
37
  font-weight: bold;
36
38
  font-size: 14px; }
37
- section.scenario > header span.feature_name {
39
+ div#steps-statistics section.scenario > header span.feature_name {
38
40
  font-size: 13px;
39
41
  color: #839496; }
40
- section.scenario > header span.permalink {
42
+ div#steps-statistics section.scenario > header span.permalink {
41
43
  margin-right: 1em;
42
44
  font-size: 15px; }
43
- section.scenario > header span.permalink a {
45
+ div#steps-statistics section.scenario > header span.permalink a {
44
46
  color: #268bd2; }
45
- section.scenario > ul.tags {
47
+ div#steps-statistics section.scenario > ul.tags {
46
48
  font-size: 12px; }
47
- section.scenario > ul.tags li {
49
+ div#steps-statistics section.scenario > ul.tags li {
48
50
  color: #839496;
49
51
  display: inline; }
50
- section.scenario.passed {
51
- border-color: green; }
52
- section.scenario.passed > header .scenario_name {
53
- color: #859900; }
54
- section.scenario.passed > header .scenario_name:before {
52
+ div#steps-statistics section.scenario.passed {
53
+ border-color: #509b49; }
54
+ div#steps-statistics section.scenario.passed > header .scenario_name {
55
+ color: #509b49; }
56
+ div#steps-statistics section.scenario.passed > header .scenario_name:before {
55
57
  content: "\2713\20"; }
56
- section.scenario.failed {
57
- border-color: #dc322f; }
58
- section.scenario.failed > header .scenario_name {
59
- color: #dc322f; }
60
- section.scenario.failed > header .scenario_name:before {
58
+ div#steps-statistics section.scenario.failed {
59
+ border-color: #ed1c24; }
60
+ div#steps-statistics section.scenario.failed > header .scenario_name {
61
+ color: #ed1c24; }
62
+ div#steps-statistics section.scenario.failed > header .scenario_name:before {
61
63
  content: "\2717\20"; }
62
- section.scenario.pending {
63
- border-color: #b58900; }
64
- section.scenario.pending > header .scenario_name {
65
- color: #b58900; }
66
- section.scenario.pending > header .scenario_name:before {
64
+ div#steps-statistics section.scenario.pending {
65
+ border-color: #d6a921; }
66
+ div#steps-statistics section.scenario.pending > header .scenario_name {
67
+ color: #d6a921; }
68
+ div#steps-statistics section.scenario.pending > header .scenario_name:before {
67
69
  content: "\d8\20"; }
68
- section.scenario ul.steps {
70
+ div#steps-statistics section.scenario ul.steps {
69
71
  font-size: 12px;
70
72
  list-style-type: none; }
71
- section.scenario ul.steps li.step {
73
+ div#steps-statistics section.scenario ul.steps li.step {
72
74
  padding: 0.5em;
73
75
  font-weight: bold;
74
76
  margin: 0.5em 0em; }
75
- section.scenario ul.steps li.step > span {
77
+ div#steps-statistics section.scenario ul.steps li.step > span {
78
+ border: 1px solid #509b49;
76
79
  padding: 0.5em;
77
80
  background-color: #eeffee;
78
- border: 1px solid #00aa00;
79
- color: #00aa00; }
80
- section.scenario ul.steps li.step > span:hover {
81
+ color: #509b49; }
82
+ div#steps-statistics section.scenario ul.steps li.step > span:hover {
81
83
  border-width: 3px; }
82
- section.scenario ul.steps li.step > span ~ * {
84
+ div#steps-statistics section.scenario ul.steps li.step > span ~ * {
83
85
  margin-left: 2em; }
84
- section.scenario ul.steps li.step div.args {
85
- font-size: 11px; }
86
- section.scenario ul.steps li.step.failure > span {
87
- background-color: #ffdddd;
88
- border: 1px solid #dd0000;
89
- color: #dd0000; }
90
- section.scenario ul.steps li.step.failure > span:hover {
91
- border-width: 3px; }
92
- section.scenario ul.steps li.step.failure > span ~ * {
93
- margin-left: 2em; }
94
- section.scenario ul.steps li.step.failure > div.args {
95
- padding: 1em;
96
- background-color: #ffeeee;
97
- border: 1px solid #cc8888; }
98
- section.scenario ul.steps li.step.failure ~ li > span {
99
- background-color: #cccccc;
100
- border: 1px solid #444444;
101
- color: #333333; }
102
- section.scenario ul.steps li.step.failure ~ li > span:hover {
103
- border-width: 3px; }
104
- section.scenario ul.steps li.step.failure ~ li > span ~ * {
105
- margin-left: 2em; }
106
- section.scenario ul.steps li.step.pending > span {
107
- background-color: #ffffbb;
108
- border: 1px solid #666600;
109
- color: #666600; }
110
- section.scenario ul.steps li.step.pending > span:hover {
111
- border-width: 3px; }
112
- section.scenario ul.steps li.step.pending > span ~ * {
113
- margin-left: 2em; }
114
- section.scenario ul.steps li.step.pending > div.args {
115
- padding: 1em;
116
- background-color: #ffffaa;
117
- border: 1px solid #999944; }
118
- section.scenario ul.steps li.step.pending ~ li > span {
119
- background-color: #cccccc;
120
- border: 1px solid #444444;
121
- color: #333333; }
122
- section.scenario ul.steps li.step.pending ~ li > span:hover {
123
- border-width: 3px; }
124
- section.scenario ul.steps li.step.pending ~ li > span ~ * {
125
- margin-left: 2em; }
126
- section.scenario ul.steps table.step_outline {
86
+ div#steps-statistics section.scenario ul.steps li.step.failure {
87
+ /* skip/pending step style */ }
88
+ div#steps-statistics section.scenario ul.steps li.step.failure > span {
89
+ border: 1px solid #ed1c24;
90
+ padding: 0.5em;
91
+ background-color: #ffdddd;
92
+ color: #ed1c24; }
93
+ div#steps-statistics section.scenario ul.steps li.step.failure > span:hover {
94
+ border-width: 3px; }
95
+ div#steps-statistics section.scenario ul.steps li.step.failure > span ~ * {
96
+ margin-left: 2em; }
97
+ div#steps-statistics section.scenario ul.steps li.step.failure > div.args {
98
+ font-size: 11px;
99
+ padding: 1em;
100
+ background-color: #ffdddd;
101
+ border: 1px solid #ed1c24; }
102
+ div#steps-statistics section.scenario ul.steps li.step.failure ~ li > span {
103
+ background-color: #dddddd;
104
+ border-color: #7a7b7d;
105
+ color: #7a7b7d; }
106
+ div#steps-statistics section.scenario ul.steps li.step.pending {
107
+ /* skip/pending step style */ }
108
+ div#steps-statistics section.scenario ul.steps li.step.pending > span {
109
+ border: 1px solid #d6a921;
110
+ padding: 0.5em;
111
+ background-color: #ffffdd;
112
+ color: #d6a921; }
113
+ div#steps-statistics section.scenario ul.steps li.step.pending > span:hover {
114
+ border-width: 3px; }
115
+ div#steps-statistics section.scenario ul.steps li.step.pending > span ~ * {
116
+ margin-left: 2em; }
117
+ div#steps-statistics section.scenario ul.steps li.step.pending > div.args {
118
+ font-size: 11px;
119
+ padding: 1em;
120
+ background-color: #ffffdd;
121
+ border: 1px solid #d6a921; }
122
+ div#steps-statistics section.scenario ul.steps li.step.pending ~ li > span {
123
+ background-color: #dddddd;
124
+ border-color: #7a7b7d;
125
+ color: #7a7b7d; }
126
+ div#steps-statistics section.scenario ul.steps table.step_outline {
127
127
  margin-top: 2em; }
128
- section.scenario ul.steps table.step_outline tr:nth-child(odd) {
128
+ div#steps-statistics section.scenario ul.steps table.step_outline tr:nth-child(odd) {
129
129
  background-color: #ddddcc; }
130
- section.scenario ul.steps table.step_outline tr:nth-child(even) {
130
+ div#steps-statistics section.scenario ul.steps table.step_outline tr:nth-child(even) {
131
131
  background-color: #ccccdd; }
132
- section.scenario ul.steps table.step_outline td {
132
+ div#steps-statistics section.scenario ul.steps table.step_outline td {
133
133
  border: 2px solid black;
134
134
  padding: 0.3em 1em; }
135
- section.scenario ul.steps pre.multiline {
135
+ div#steps-statistics section.scenario ul.steps pre.multiline {
136
136
  margin-top: 2em;
137
137
  font-size: 13px;
138
138
  color: #586e75; }
139
- section.scenario ul.steps div.step_exception {
140
- margin: 1em 0em 1em 0em;
139
+ div#steps-statistics section.scenario ul.steps div.step_exception {
140
+ margin: 1em 0em;
141
141
  padding: 1em 0em 1em 1em;
142
142
  border: 1px solid #999999;
143
143
  background-color: #eee8d5;
144
144
  color: #586e75; }
145
- section.scenario ul.steps div.step_exception > pre {
145
+ div#steps-statistics section.scenario ul.steps div.step_exception > pre {
146
146
  margin-left: 1em; }
147
- section.scenario ul.steps pre.source {
147
+ div#steps-statistics section.scenario ul.steps pre.source {
148
148
  font-size: 12px;
149
149
  font-family: monospace;
150
150
  background-color: #073642;
151
151
  color: #dddddd; }
152
- section.scenario ul.steps pre.source code.ruby {
152
+ div#steps-statistics section.scenario ul.steps pre.source code.ruby {
153
153
  padding: 0.1em 0 0.2em 0; }
154
- section.scenario ul.steps pre.source code.ruby .linenum {
154
+ div#steps-statistics section.scenario ul.steps pre.source code.ruby .linenum {
155
155
  width: 75px;
156
156
  color: #fffbd3;
157
157
  padding-right: 1em; }
158
- section.scenario ul.steps pre.source code.ruby .offending {
158
+ div#steps-statistics section.scenario ul.steps pre.source code.ruby .offending {
159
159
  background-color: gray; }
160
160
 
161
+ div#speed-statistics table,
162
+ div#feature-statistics table,
163
+ div#tag-statistics table {
164
+ width: 100%;
165
+ margin: 1em 0em; }
166
+ div#speed-statistics table thead th,
167
+ div#feature-statistics table thead th,
168
+ div#tag-statistics table thead th {
169
+ border-bottom: 1px solid #7a7b7d; }
170
+ div#speed-statistics table tbody tr:nth-child(odd),
171
+ div#feature-statistics table tbody tr:nth-child(odd),
172
+ div#tag-statistics table tbody tr:nth-child(odd) {
173
+ background-color: #FFFFFF; }
174
+ div#speed-statistics table tbody tr:nth-child(even),
175
+ div#feature-statistics table tbody tr:nth-child(even),
176
+ div#tag-statistics table tbody tr:nth-child(even) {
177
+ background-color: #dddddd; }
178
+ div#speed-statistics table tbody td,
179
+ div#feature-statistics table tbody td,
180
+ div#tag-statistics table tbody td {
181
+ border: 1px solid #7a7b7d;
182
+ padding: 0.3em 1em; }
183
+ div#speed-statistics table tbody td.passed,
184
+ div#feature-statistics table tbody td.passed,
185
+ div#tag-statistics table tbody td.passed {
186
+ background-color: #eeffee;
187
+ color: #509b49; }
188
+ div#speed-statistics table tbody td.failed,
189
+ div#feature-statistics table tbody td.failed,
190
+ div#tag-statistics table tbody td.failed {
191
+ background-color: #ffdddd;
192
+ color: #ed1c24; }
193
+ div#speed-statistics table tbody td.pending,
194
+ div#feature-statistics table tbody td.pending,
195
+ div#tag-statistics table tbody td.pending {
196
+ background-color: #ffffdd;
197
+ color: #d6a921; }
198
+
199
+ div#speed-statistics .tablesorter-header {
200
+ background-position: center right;
201
+ background-repeat: no-repeat;
202
+ cursor: pointer;
203
+ background-image: url("data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw=="); }
204
+ div#speed-statistics .tablesorter-header.sorter-false {
205
+ background: none; }
206
+ div#speed-statistics .tablesorter-headerAsc {
207
+ background-position: center right;
208
+ background-repeat: no-repeat;
209
+ cursor: pointer;
210
+ background-image: url("data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7"); }
211
+ div#speed-statistics .tablesorter-headerDesc {
212
+ background-position: center right;
213
+ background-repeat: no-repeat;
214
+ cursor: pointer;
215
+ background-image: url("data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7"); }
216
+
161
217
  section.exception {
162
218
  margin: 1em 0em;
163
219
  border: 2px solid #268bd2;