turnip_formatter 0.2.11 → 0.3.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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/README.md +18 -22
  4. data/example/README.md +6 -8
  5. data/example/images/background.png +0 -0
  6. data/example/images/basic_step.png +0 -0
  7. data/example/images/failed_step.png +0 -0
  8. data/example/images/multiline.png +0 -0
  9. data/example/images/outline.png +0 -0
  10. data/example/images/pending_step.png +0 -0
  11. data/example/spec/bar.js +1 -0
  12. data/example/spec/foo.css +3 -0
  13. data/example/spec/spec_helper.rb +7 -2
  14. data/lib/rspec/core/formatters/turnip_formatter.rb +32 -19
  15. data/lib/turnip_formatter/printer/index.rb +6 -9
  16. data/lib/turnip_formatter/printer/scenario.rb +4 -2
  17. data/lib/turnip_formatter/printer/step.rb +16 -14
  18. data/lib/turnip_formatter/printer/step_extra_args.rb +2 -0
  19. data/lib/turnip_formatter/printer/tab_speed_statistics.rb +2 -1
  20. data/lib/turnip_formatter/printer/tab_tag_statistics.rb +5 -6
  21. data/lib/turnip_formatter/printer.rb +6 -11
  22. data/lib/turnip_formatter/scenario/base.rb +98 -0
  23. data/lib/turnip_formatter/scenario/failure.rb +19 -21
  24. data/lib/turnip_formatter/scenario/pass.rb +2 -13
  25. data/lib/turnip_formatter/scenario/pending.rb +19 -25
  26. data/lib/turnip_formatter/step.rb +8 -38
  27. data/lib/turnip_formatter/step_template/base.rb +34 -0
  28. data/lib/turnip_formatter/step_template/exception.rb +59 -50
  29. data/lib/turnip_formatter/step_template/source.rb +36 -34
  30. data/lib/turnip_formatter/template/exception.haml +8 -0
  31. data/lib/turnip_formatter/template/index.haml +88 -0
  32. data/lib/turnip_formatter/template/runtime_exception.haml +13 -0
  33. data/lib/turnip_formatter/template/scenario.haml +14 -0
  34. data/lib/turnip_formatter/template/step.haml +6 -0
  35. data/lib/turnip_formatter/template/step_multiline.haml +1 -0
  36. data/lib/turnip_formatter/template/step_outline.haml +6 -0
  37. data/lib/turnip_formatter/template/tab_feature_statistics.haml +18 -0
  38. data/lib/turnip_formatter/template/tab_speed_statistics.haml +16 -0
  39. data/lib/turnip_formatter/template/tab_tag_statistics.haml +18 -0
  40. data/lib/turnip_formatter/template/turnip_formatter.js +8 -25
  41. data/lib/turnip_formatter/template/turnip_formatter.scss +102 -174
  42. data/lib/turnip_formatter/template.rb +65 -39
  43. data/lib/turnip_formatter/version.rb +1 -1
  44. data/lib/turnip_formatter.rb +45 -7
  45. data/spec/spec_helper.rb +6 -1
  46. data/spec/support/example_helper.rb +36 -0
  47. data/spec/support/step_helper.rb +27 -0
  48. data/spec/turnip_formatter/printer/index_spec.rb +10 -10
  49. data/spec/turnip_formatter/printer/scenario_spec.rb +29 -23
  50. data/spec/turnip_formatter/printer/step_extra_args_spec.rb +6 -6
  51. data/spec/turnip_formatter/printer/step_spec.rb +36 -69
  52. data/spec/turnip_formatter/printer/tab_feature_statistics_spec.rb +1 -4
  53. data/spec/turnip_formatter/printer/tab_speed_statistics_spec.rb +1 -4
  54. data/spec/turnip_formatter/printer/tab_tag_statistics_spec.rb +1 -4
  55. data/spec/turnip_formatter/scenario/base_spec.rb +67 -0
  56. data/spec/turnip_formatter/scenario/failure_spec.rb +16 -38
  57. data/spec/turnip_formatter/scenario/pending_spec.rb +16 -39
  58. data/spec/turnip_formatter/step_template/base_spec.rb +82 -0
  59. data/spec/turnip_formatter/step_template/exception_spec.rb +25 -17
  60. data/spec/turnip_formatter/step_template/source_spec.rb +10 -13
  61. data/turnip_formatter.gemspec +15 -11
  62. metadata +83 -41
  63. data/example/images/tag_step.png +0 -0
  64. data/images/tab_feature_statistics.png +0 -0
  65. data/images/tab_speed_statistics.png +0 -0
  66. data/images/tab_steps.png +0 -0
  67. data/images/tab_steps_expanding.png +0 -0
  68. data/images/tab_tag_statistics.png +0 -0
  69. data/lib/turnip_formatter/ext/turnip/builder.rb +0 -47
  70. data/lib/turnip_formatter/scenario.rb +0 -89
  71. data/lib/turnip_formatter/step/dsl.rb +0 -33
  72. data/lib/turnip_formatter/step/failure.rb +0 -19
  73. data/lib/turnip_formatter/step/pending.rb +0 -19
  74. data/lib/turnip_formatter/step_template.rb +0 -8
  75. data/lib/turnip_formatter/template/exception.erb +0 -10
  76. data/lib/turnip_formatter/template/exception_backtrace.erb +0 -7
  77. data/lib/turnip_formatter/template/index.erb +0 -70
  78. data/lib/turnip_formatter/template/runtime_exception.erb +0 -16
  79. data/lib/turnip_formatter/template/scenario.erb +0 -25
  80. data/lib/turnip_formatter/template/section_report.erb +0 -15
  81. data/lib/turnip_formatter/template/step.erb +0 -4
  82. data/lib/turnip_formatter/template/step_multiline.erb +0 -1
  83. data/lib/turnip_formatter/template/step_outline.erb +0 -9
  84. data/lib/turnip_formatter/template/tab_feature_statistics.erb +0 -24
  85. data/lib/turnip_formatter/template/tab_speed_statistics.erb +0 -18
  86. data/lib/turnip_formatter/template/tab_tag_statistics.erb +0 -24
  87. data/spec/rspec/core/formatters/turnip_formatter_spec.rb +0 -78
  88. data/spec/support/shared_context_examples.rb +0 -39
  89. data/spec/turnip_formatter/scenario/pass_spec.rb +0 -54
  90. data/spec/turnip_formatter/step/failure_spec.rb +0 -64
  91. data/spec/turnip_formatter/step/pending_spec.rb +0 -63
  92. data/spec/turnip_formatter/step_spec.rb +0 -86
@@ -1,101 +1,50 @@
1
- $red-front: #ED1C24;
2
- $green-front: #509B49;
3
- $yellow-front: #D6A921;
4
- $red-background: #FFDDDD;
5
- $green-background: #EEFFEE;
6
- $yellow-background: #FFFFDD;
7
- $gray-front: #7A7B7D;
8
- $gray-background: #DDDDDD;
9
-
10
- @mixin step_span($front, $back, $with_args: false) {
11
- > span {
12
- border: 1px solid $front;
13
- padding: 0.5em;
14
- background-color: $back;
15
- color: $front;
16
-
17
- &:hover { border-width: 3px; }
18
- ~ * { margin-left: 2em; }
19
- }
20
-
21
- @if $with_args {
1
+ @import "bootstrap";
22
2
 
23
- > div.args {
24
- font-size: 11px;
25
- padding: 1em;
26
- background-color: $back;
27
- border: 1px solid $front;
28
- }
29
-
30
- /* skip/pending step style */
31
- ~ li > span {
32
- background-color: $gray-background;
33
- border-color: $gray-front;
34
- color: $gray-front;
35
- }
36
- }
37
- }
3
+ article {
4
+ @extend .panel;
5
+ @extend .panel-success;
38
6
 
39
- @mixin content_centering {
40
- margin: 0 auto;
41
- padding: 2em;
42
- }
7
+ header {
8
+ @extend .panel-heading;
9
+ }
43
10
 
44
- body {
45
- margin: 0;
46
- background-color: #ffffff;
11
+ section {
12
+ @extend .panel-body;
13
+ }
47
14
  }
48
15
 
49
- div#report {
50
- @include content_centering;
51
- background: black;
52
- color: $green-front;
16
+ #report {
17
+ #status_display_switch {
18
+ label {
19
+ @extend .checkbox-inline;
20
+ }
21
+ }
53
22
  }
54
23
 
55
- footer {
56
- @include content_centering;
57
- background: black;
58
- color: $green-front;
59
- text-align: right;
60
- }
61
24
 
62
- div#main {
63
- @include content_centering;
64
- background-color: #ffffff;
25
+ div#steps-statistics section.scenario {
26
+ @extend .panel;
65
27
 
66
- .ui-tabs-nav {
67
- border-width: 0;
68
- padding: 0;
28
+ &.passed {
29
+ @extend .panel-success;
69
30
  }
70
31
 
71
- .ui-tabs-panel {
72
- border: 1px solid $gray-front;
32
+ &.failed {
33
+ @extend .panel-danger;
73
34
  }
74
- }
75
35
 
76
- div#steps-statistics section.scenario {
77
- margin: 1em 0em;
78
- padding-left: 1em;
79
- border: 2px solid green;
36
+ &.pending {
37
+ @extend .panel-warning;
38
+ }
80
39
 
81
- > header {
82
- margin: 1em 0em;
40
+ div.scenario-title {
41
+ @extend .panel-heading;
83
42
 
84
43
  &:hover {
85
44
  text-decoration: underline;
86
45
  cursor: pointer;
87
46
  }
88
47
 
89
- span.scenario_name {
90
- font-weight: bold;
91
- font-size: 14px;
92
- }
93
-
94
- span.feature_name {
95
- font-size: 13px;
96
- color: #839496;
97
- }
98
-
99
48
  span.permalink {
100
49
  margin-right: 1em;
101
50
  font-size: 15px;
@@ -103,137 +52,90 @@ div#steps-statistics section.scenario {
103
52
  }
104
53
  }
105
54
 
106
- > ul.tags {
107
- font-size: 12px;
108
-
109
- li {
110
- color: #839496;
111
- display: inline;
112
- }
113
- }
114
-
115
- &.passed {
116
- border-color: $green-front;
117
-
118
- > header .scenario_name {
119
- color: $green-front;
120
- &:before { content: "\2713\20"; }
121
- }
55
+ ul.tags {
56
+ @extend .list-inline;
122
57
  }
123
58
 
124
- &.failed {
125
- border-color: $red-front;
126
-
127
- > header .scenario_name {
128
- color: $red-front;
129
- &:before { content: "\2717\20"; }
130
- }
131
- }
59
+ div.steps {
60
+ @extend .panel-group;
132
61
 
133
- &.pending {
134
- border-color: $yellow-front;
62
+ div.step {
63
+ @extend .panel;
135
64
 
136
- > header .scenario_name {
137
- color: $yellow-front;
138
- &:before { content: "\d8\20"; }
139
- }
140
- }
141
-
142
- ul.steps {
143
- font-size: 12px;
144
- list-style-type: none;
145
-
146
- li.step {
147
- padding: 0.5em;
148
- font-weight: bold;
149
- margin: 0.5em 0em;
150
-
151
- @include step_span($green-front, $green-background);
65
+ &.passed {
66
+ @extend .panel-success;
67
+ }
152
68
 
153
- &.failure {
154
- @include step_span($red-front, $red-background, true);
69
+ &.failed {
70
+ @extend .panel-danger;
155
71
  }
156
72
 
157
73
  &.pending {
158
- @include step_span($yellow-front, $yellow-background, true);
74
+ @extend .panel-warning;
159
75
  }
160
- }
161
76
 
162
- table.step_outline {
163
- margin-top: 2em;
77
+ &.unexecuted {
78
+ @extend .panel-info;
79
+ }
164
80
 
165
- tr:nth-child(odd) {
166
- background-color: #ddddcc;
81
+ div.step-title {
82
+ @extend .panel-heading;
167
83
  }
168
84
 
169
- tr:nth-child(even) {
170
- background-color: #ccccdd;
85
+ div.step-body {
86
+ @extend .panel-body;
171
87
  }
172
88
 
173
- td {
174
- border: 2px solid black;
175
- padding: 0.3em 1em;
89
+ table.step_outline {
90
+ margin-top: 2em;
91
+ @extend .table;
92
+ @extend .table-striped;
93
+ @extend .table-bordered;
176
94
  }
177
- }
178
95
 
179
- pre.multiline {
180
- margin-top: 2em;
181
- font-size: 13px;
182
- color: #586e75;
96
+ pre.multiline {
97
+ margin-top: 2em;
98
+ font-size: 13px;
99
+ color: #586e75;
100
+ }
183
101
  }
184
102
  }
185
103
  }
186
104
 
187
- @mixin tablesorter-header {
188
- background-position: center right;
189
- background-repeat: no-repeat;
190
- cursor: pointer;
191
- }
192
-
193
- div#speed-statistics,
194
105
  div#feature-statistics,
195
106
  div#tag-statistics {
196
107
  table {
197
- width: 100%;
198
- margin: 1em 0em;
199
-
200
- thead {
201
- th {
202
- border-bottom: 1px solid $gray-front;
203
- }
204
- }
108
+ @extend .table;
109
+ @extend .table-hover;
205
110
 
206
- tbody {
207
- tr:nth-child(odd) {
208
- background-color: #FFFFFF;
111
+ tbody td {
112
+ &.passed {
113
+ @extend .success;
209
114
  }
210
115
 
211
- tr:nth-child(even) {
212
- background-color: $gray-background;
116
+ &.failed {
117
+ @extend .danger;
213
118
  }
214
119
 
215
- td {
216
- border: 1px solid $gray-front;
217
- padding: 0.3em 1em;
218
-
219
- &.passed {
220
- background-color: $green-background;
221
- color: $green-front;
222
- }
223
- &.failed {
224
- background-color: $red-background;
225
- color: $red-front;
226
- }
227
- &.pending {
228
- background-color: $yellow-background;
229
- color: $yellow-front;
230
- }
120
+ &.pending {
121
+ @extend .warning;
231
122
  }
232
123
  }
233
124
  }
234
125
  }
235
126
 
127
+ @mixin tablesorter-header {
128
+ background-position: center right;
129
+ background-repeat: no-repeat;
130
+ cursor: pointer;
131
+ }
132
+
236
133
  div#speed-statistics {
134
+ table {
135
+ @extend .table;
136
+ @extend .table-hover;
137
+ }
138
+
237
139
  .tablesorter-header {
238
140
  @include tablesorter-header;
239
141
  background-image: url("data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==");
@@ -269,3 +171,29 @@ section.exception {
269
171
  font-size: 14px;
270
172
  }
271
173
  }
174
+
175
+ // Sticky footer styles
176
+ // refs: http://getbootstrap.com/examples/sticky-footer/sticky-footer.css
177
+
178
+ html {
179
+ position: relative;
180
+ min-height: 100%;
181
+ }
182
+
183
+ body {
184
+ margin-bottom: 80px;
185
+ }
186
+
187
+ footer {
188
+ @extend .text-right;
189
+ @extend .container;
190
+
191
+ bottom: 0;
192
+ height: 80px;
193
+ padding-top: 1em;
194
+ border-top: 1px solid #dddddd;
195
+
196
+ p {
197
+ @extend .text-muted;
198
+ }
199
+ }
@@ -1,73 +1,68 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- require 'turnip_formatter/template'
3
+ require 'uri'
4
4
  require 'sass'
5
+ require 'bootstrap-sass'
5
6
 
6
7
  module TurnipFormatter
7
8
  class Template
8
9
  class << self
9
10
  def project_name
10
- RSpec.configuration.respond_to?(:project_name) ? RSpec.configuration.project_name : 'Turnip'
11
+ TurnipFormatter.configuration.title
11
12
  end
12
13
 
13
- def add_js(js_string)
14
- js_list << js_string
15
- end
16
-
17
- def add_js_file(file)
18
- if URI(file).scheme
19
- js_file_list << file
20
- else
21
- js_list << File.read(file)
14
+ def add_javascript(script)
15
+ case
16
+ when local_file?(script)
17
+ add_javascript_code File.read(script)
18
+ when remote_url?(script)
19
+ add_javascript_link script
22
20
  end
23
21
  end
24
22
 
25
- def add_scss(scss_string)
26
- css_list << Sass::Engine.new(scss_string, scss_option).render
27
- end
28
-
29
- def add_css_file(file)
30
- if URI(file).scheme
31
- css_file_list << file
32
- else
33
- add_scss_file(file)
23
+ def add_stylesheet(stylesheet)
24
+ case
25
+ when local_file?(stylesheet)
26
+ add_stylesheet_code File.read(stylesheet)
27
+ when remote_url?(stylesheet)
28
+ add_stylesheet_link stylesheet
34
29
  end
35
30
  end
36
31
 
37
- def add_scss_file(path)
38
- css_list << Sass::Engine.for_file(path, scss_option).render
32
+ def render_javascript_codes
33
+ js_code_list.join("\n")
39
34
  end
40
35
 
41
- def js_render
42
- js_list.join("\n")
43
- end
44
-
45
- def js_file_render
36
+ def render_javascript_links
46
37
  js_file_list.map do |file|
47
38
  "<script src=\"#{file}\" type=\"text/javascript\"></script>"
48
39
  end.join("\n")
49
40
  end
50
41
 
51
- def css_render
52
- css_list.join("\n")
42
+ def render_stylesheet_codes
43
+ TurnipFormatter.step_templates.each do |template|
44
+ add_stylesheet_code(template.class.scss)
45
+ end
46
+
47
+ css_code_list.join("\n")
53
48
  end
54
49
 
55
- def css_file_render
50
+ def render_stylesheet_links
56
51
  css_file_list.map do |file|
57
52
  "<link rel=\"stylesheet\" href=\"#{file}\">"
58
53
  end.join("\n")
59
54
  end
60
55
 
61
- def js_list
62
- @js_list ||= []
56
+ def js_code_list
57
+ @js_code_list ||= []
63
58
  end
64
59
 
65
60
  def js_file_list
66
61
  @js_file_list ||= []
67
62
  end
68
63
 
69
- def css_list
70
- @css_list ||= []
64
+ def css_code_list
65
+ @css_code_list ||= []
71
66
  end
72
67
 
73
68
  def css_file_list
@@ -77,11 +72,42 @@ module TurnipFormatter
77
72
  def scss_option
78
73
  { syntax: :scss, style: :compressed }
79
74
  end
75
+
76
+ private
77
+
78
+ def add_javascript_code(code)
79
+ js_code_list << code
80
+ end
81
+
82
+ def add_javascript_link(link)
83
+ js_file_list << link
84
+ end
85
+
86
+ def add_stylesheet_code(code)
87
+ css_code_list << Sass::Engine.new(code, scss_option).render
88
+ end
89
+
90
+ def add_stylesheet_link(file)
91
+ css_file_list << file
92
+ end
93
+
94
+ def local_file?(path)
95
+ File.exist? path
96
+ end
97
+
98
+ def remote_url?(path)
99
+ uri = URI.parse(path)
100
+ return true if %w(http https).include?(uri.scheme)
101
+ return true if (uri.scheme.nil? && path.start_with?('//'))
102
+ false
103
+ rescue URI::InvalidURIError
104
+ null
105
+ end
80
106
  end
81
- end
82
- end
83
107
 
84
- (File.dirname(__FILE__) + '/template').tap do |dirname|
85
- TurnipFormatter::Template.add_css_file(dirname + '/turnip_formatter.scss')
86
- TurnipFormatter::Template.add_js_file(dirname + '/turnip_formatter.js')
108
+ (File.dirname(__FILE__) + '/template').tap do |dirname|
109
+ add_stylesheet(dirname + '/turnip_formatter.scss')
110
+ add_javascript(dirname + '/turnip_formatter.js')
111
+ end
112
+ end
87
113
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module TurnipFormatter
4
- VERSION = "0.2.11"
4
+ VERSION = '0.3.0'
5
5
  end
@@ -1,19 +1,57 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require "turnip_formatter/version"
1
+ require 'turnip_formatter/version'
4
2
  require 'turnip'
5
3
 
6
4
  module TurnipFormatter
5
+ class << self
6
+ attr_accessor :title
7
+
8
+ def step_templates
9
+ @step_templates ||= []
10
+ end
11
+
12
+ def step_templates_for(status)
13
+ step_templates.reduce([]) do |templates, t|
14
+ hooks = t.class.hooks
15
+ return templates unless hooks.key?(status)
16
+ templates + [t].product(hooks[status])
17
+ end
18
+ end
19
+
20
+ def add_stylesheet(stylesheets)
21
+ stylesheets = [stylesheets] if stylesheets.is_a? String
22
+
23
+ stylesheets.each do |s|
24
+ TurnipFormatter::Template.add_stylesheet(s)
25
+ end
26
+ end
27
+
28
+ def add_javascript(scripts)
29
+ scripts = [scripts] if scripts.is_a? String
30
+
31
+ scripts.each do |s|
32
+ TurnipFormatter::Template.add_javascript(s)
33
+ end
34
+ end
35
+
36
+ def configure
37
+ yield self
38
+ end
39
+
40
+ def configuration
41
+ self
42
+ end
43
+ end
44
+
7
45
  require 'rspec/core/formatters/turnip_formatter'
8
46
  require 'turnip_formatter/template'
9
- require 'turnip_formatter/step_template'
47
+ require 'turnip_formatter/step_template/exception'
48
+ require 'turnip_formatter/step_template/source'
10
49
  require 'turnip_formatter/ext/turnip/rspec'
11
- require 'turnip_formatter/ext/turnip/builder'
12
50
  require 'turnip_formatter/printer/index'
13
51
  end
14
52
 
15
53
  RSpecTurnipFormatter = RSpec::Core::Formatters::TurnipFormatter
16
54
 
17
- RSpec.configure do |config|
18
- config.add_setting :project_name, :default => "Turnip"
55
+ TurnipFormatter.configure do |config|
56
+ config.title = 'Turnip'
19
57
  end
data/spec/spec_helper.rb CHANGED
@@ -10,10 +10,15 @@ end
10
10
 
11
11
  require 'rspec-html-matchers'
12
12
  require 'turnip_formatter'
13
- Dir.glob(File.dirname(__FILE__) + "/support/**/*.rb") { |f| require(f) }
13
+ Dir.glob(File.dirname(__FILE__) + '/support/**/*.rb') { |f| require(f) }
14
14
 
15
15
  class NoopObject
16
16
  def method_missing(name, *args, &block)
17
17
  # nooooooop
18
18
  end
19
19
  end
20
+
21
+ RSpec.configure do |config|
22
+ config.include ExampleHelper
23
+ config.include StepHelper
24
+ end
@@ -0,0 +1,36 @@
1
+ module ExampleHelper
2
+ def passed_example
3
+ base_example { expect(true).to be true }
4
+ end
5
+
6
+ def failed_example
7
+ example = base_example { expect(true).to be false }
8
+ example.exception.backtrace.push ':in step:0 `'
9
+ example
10
+ end
11
+
12
+ def pending_example
13
+ example = base_example { pending('Pending') }
14
+ example.execution_result[:pending_message] = 'No such step(0): '
15
+ example
16
+ end
17
+
18
+ private
19
+
20
+ def base_example(&assertion)
21
+ group = ::RSpec::Core::ExampleGroup.describe('Feature').describe('Scenario')
22
+ example = group.example('example', example_metadata, &assertion)
23
+ group.run(NoopObject.new)
24
+ example
25
+ end
26
+
27
+ def example_metadata
28
+ {
29
+ turnip_formatter: {
30
+ steps: [ { name: 'Step 1', extra_args: [], keyword: 'When' } ],
31
+ tags: []
32
+ },
33
+ file_path: '/path/to/hoge.feature'
34
+ }
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ require 'support/example_helper'
2
+
3
+ module StepHelper
4
+ include ExampleHelper
5
+
6
+ def passed_step
7
+ base_step(passed_example)
8
+ end
9
+
10
+ def failed_step
11
+ base_step(failed_example).tap { |s| s.status = :failed }
12
+ end
13
+
14
+ def pending_step
15
+ base_step(pending_example).tap { |s| s.status = :pending }
16
+ end
17
+
18
+ private
19
+
20
+ def base_step(example)
21
+ TurnipFormatter::Step.new(example, step_description)
22
+ end
23
+
24
+ def step_description
25
+ { name: 'StepName', keyword: 'Keyword', extra_args: ['Docstring'] }
26
+ end
27
+ end
@@ -5,13 +5,13 @@ module TurnipFormatter::Printer
5
5
  describe Index do
6
6
 
7
7
  let(:formatter) do
8
- double("Formatter", {
9
- :scenarios => [],
10
- :passed_scenarios => [],
11
- :failure_count => 0,
12
- :pending_count => 0,
13
- :duration => 0
14
- })
8
+ {
9
+ scenarios: [],
10
+ scenario_files: [],
11
+ failed_count: 0,
12
+ pending_count: 0,
13
+ duration: 0
14
+ }
15
15
  end
16
16
 
17
17
  describe '.print_out' do
@@ -22,8 +22,8 @@ module TurnipFormatter::Printer
22
22
 
23
23
  context 'project_name is changed' do
24
24
  before do
25
- @original_project_name = RSpec.configuration.project_name
26
- RSpec.configuration.project_name = 'My Project'
25
+ @original_project_name = TurnipFormatter.configuration.title
26
+ TurnipFormatter.configuration.title = 'My Project'
27
27
  end
28
28
 
29
29
  describe '.print_out' do
@@ -33,7 +33,7 @@ module TurnipFormatter::Printer
33
33
  end
34
34
 
35
35
  after do
36
- RSpec.configuration.project_name = @original_project_name
36
+ TurnipFormatter.configuration.title = @original_project_name
37
37
  end
38
38
  end
39
39
  end