rspec-core 2.11.1 → 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/.document +1 -1
  4. data/.yardopts +3 -1
  5. data/Changelog.md +1814 -29
  6. data/{License.txt → LICENSE.md} +6 -4
  7. data/README.md +197 -48
  8. data/exe/rspec +2 -23
  9. data/lib/rspec/autorun.rb +1 -0
  10. data/lib/rspec/core/backtrace_formatter.rb +65 -0
  11. data/lib/rspec/core/bisect/coordinator.rb +62 -0
  12. data/lib/rspec/core/bisect/example_minimizer.rb +173 -0
  13. data/lib/rspec/core/bisect/fork_runner.rb +138 -0
  14. data/lib/rspec/core/bisect/server.rb +61 -0
  15. data/lib/rspec/core/bisect/shell_command.rb +126 -0
  16. data/lib/rspec/core/bisect/shell_runner.rb +73 -0
  17. data/lib/rspec/core/bisect/utilities.rb +69 -0
  18. data/lib/rspec/core/configuration.rb +1846 -407
  19. data/lib/rspec/core/configuration_options.rb +154 -50
  20. data/lib/rspec/core/did_you_mean.rb +46 -0
  21. data/lib/rspec/core/drb.rb +120 -0
  22. data/lib/rspec/core/dsl.rb +90 -18
  23. data/lib/rspec/core/example.rb +488 -152
  24. data/lib/rspec/core/example_group.rb +733 -294
  25. data/lib/rspec/core/example_status_persister.rb +235 -0
  26. data/lib/rspec/core/filter_manager.rb +175 -147
  27. data/lib/rspec/core/flat_map.rb +20 -0
  28. data/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
  29. data/lib/rspec/core/formatters/base_formatter.rb +32 -130
  30. data/lib/rspec/core/formatters/base_text_formatter.rb +62 -190
  31. data/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
  32. data/lib/rspec/core/formatters/bisect_progress_formatter.rb +157 -0
  33. data/lib/rspec/core/formatters/console_codes.rb +76 -0
  34. data/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
  35. data/lib/rspec/core/formatters/documentation_formatter.rb +62 -27
  36. data/lib/rspec/core/formatters/exception_presenter.rb +521 -0
  37. data/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
  38. data/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
  39. data/lib/rspec/core/formatters/helpers.rb +93 -14
  40. data/lib/rspec/core/formatters/html_formatter.rb +104 -415
  41. data/lib/rspec/core/formatters/html_printer.rb +414 -0
  42. data/lib/rspec/core/formatters/html_snippet_extractor.rb +120 -0
  43. data/lib/rspec/core/formatters/json_formatter.rb +102 -0
  44. data/lib/rspec/core/formatters/profile_formatter.rb +68 -0
  45. data/lib/rspec/core/formatters/progress_formatter.rb +12 -15
  46. data/lib/rspec/core/formatters/protocol.rb +182 -0
  47. data/lib/rspec/core/formatters/snippet_extractor.rb +115 -39
  48. data/lib/rspec/core/formatters/syntax_highlighter.rb +91 -0
  49. data/lib/rspec/core/formatters.rb +279 -0
  50. data/lib/rspec/core/hooks.rb +451 -300
  51. data/lib/rspec/core/invocations.rb +87 -0
  52. data/lib/rspec/core/memoized_helpers.rb +580 -0
  53. data/lib/rspec/core/metadata.rb +395 -173
  54. data/lib/rspec/core/metadata_filter.rb +255 -0
  55. data/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
  56. data/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
  57. data/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
  58. data/lib/rspec/core/mocking_adapters/null.rb +14 -0
  59. data/lib/rspec/core/mocking_adapters/rr.rb +31 -0
  60. data/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
  61. data/lib/rspec/core/notifications.rb +521 -0
  62. data/lib/rspec/core/option_parser.rb +208 -64
  63. data/lib/rspec/core/ordering.rb +169 -0
  64. data/lib/rspec/core/output_wrapper.rb +29 -0
  65. data/lib/rspec/core/pending.rb +115 -59
  66. data/lib/rspec/core/profiler.rb +34 -0
  67. data/lib/rspec/core/project_initializer/.rspec +1 -0
  68. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +98 -0
  69. data/lib/rspec/core/project_initializer.rb +26 -65
  70. data/lib/rspec/core/rake_task.rb +140 -131
  71. data/lib/rspec/core/reporter.rb +207 -44
  72. data/lib/rspec/core/ruby_project.rb +15 -6
  73. data/lib/rspec/core/runner.rb +180 -44
  74. data/lib/rspec/core/sandbox.rb +37 -0
  75. data/lib/rspec/core/set.rb +54 -0
  76. data/lib/rspec/core/shared_context.rb +25 -19
  77. data/lib/rspec/core/shared_example_group.rb +229 -54
  78. data/lib/rspec/core/shell_escape.rb +49 -0
  79. data/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
  80. data/lib/rspec/core/version.rb +3 -1
  81. data/lib/rspec/core/warnings.rb +40 -0
  82. data/lib/rspec/core/world.rb +208 -49
  83. data/lib/rspec/core.rb +166 -80
  84. data.tar.gz.sig +0 -0
  85. metadata +230 -445
  86. metadata.gz.sig +0 -0
  87. data/exe/autospec +0 -13
  88. data/features/Autotest.md +0 -38
  89. data/features/README.md +0 -17
  90. data/features/Upgrade.md +0 -364
  91. data/features/command_line/README.md +0 -28
  92. data/features/command_line/example_name_option.feature +0 -101
  93. data/features/command_line/exit_status.feature +0 -83
  94. data/features/command_line/format_option.feature +0 -81
  95. data/features/command_line/init.feature +0 -18
  96. data/features/command_line/line_number_appended_to_path.feature +0 -140
  97. data/features/command_line/line_number_option.feature +0 -58
  98. data/features/command_line/order.feature +0 -29
  99. data/features/command_line/pattern_option.feature +0 -31
  100. data/features/command_line/rake_task.feature +0 -68
  101. data/features/command_line/ruby.feature +0 -22
  102. data/features/command_line/tag.feature +0 -91
  103. data/features/configuration/alias_example_to.feature +0 -48
  104. data/features/configuration/custom_settings.feature +0 -84
  105. data/features/configuration/default_path.feature +0 -38
  106. data/features/configuration/fail_fast.feature +0 -77
  107. data/features/configuration/read_options_from_file.feature +0 -87
  108. data/features/example_groups/basic_structure.feature +0 -55
  109. data/features/example_groups/shared_context.feature +0 -74
  110. data/features/example_groups/shared_examples.feature +0 -204
  111. data/features/expectation_framework_integration/configure_expectation_framework.feature +0 -102
  112. data/features/filtering/exclusion_filters.feature +0 -139
  113. data/features/filtering/if_and_unless.feature +0 -168
  114. data/features/filtering/inclusion_filters.feature +0 -105
  115. data/features/filtering/run_all_when_everything_filtered.feature +0 -46
  116. data/features/formatters/custom_formatter.feature +0 -36
  117. data/features/formatters/text_formatter.feature +0 -46
  118. data/features/helper_methods/arbitrary_methods.feature +0 -40
  119. data/features/helper_methods/let.feature +0 -50
  120. data/features/helper_methods/modules.feature +0 -149
  121. data/features/hooks/around_hooks.feature +0 -343
  122. data/features/hooks/before_and_after_hooks.feature +0 -423
  123. data/features/hooks/filtering.feature +0 -234
  124. data/features/metadata/current_example.feature +0 -17
  125. data/features/metadata/described_class.feature +0 -17
  126. data/features/metadata/user_defined.feature +0 -113
  127. data/features/mock_framework_integration/use_any_framework.feature +0 -106
  128. data/features/mock_framework_integration/use_flexmock.feature +0 -96
  129. data/features/mock_framework_integration/use_mocha.feature +0 -97
  130. data/features/mock_framework_integration/use_rr.feature +0 -98
  131. data/features/mock_framework_integration/use_rspec.feature +0 -97
  132. data/features/pending/pending_examples.feature +0 -229
  133. data/features/spec_files/arbitrary_file_suffix.feature +0 -13
  134. data/features/step_definitions/additional_cli_steps.rb +0 -30
  135. data/features/subject/attribute_of_subject.feature +0 -124
  136. data/features/subject/explicit_subject.feature +0 -82
  137. data/features/subject/implicit_receiver.feature +0 -29
  138. data/features/subject/implicit_subject.feature +0 -63
  139. data/features/support/env.rb +0 -12
  140. data/lib/autotest/discover.rb +0 -1
  141. data/lib/autotest/rspec2.rb +0 -73
  142. data/lib/rspec/core/backward_compatibility.rb +0 -65
  143. data/lib/rspec/core/command_line.rb +0 -36
  144. data/lib/rspec/core/deprecation.rb +0 -36
  145. data/lib/rspec/core/drb_command_line.rb +0 -26
  146. data/lib/rspec/core/drb_options.rb +0 -87
  147. data/lib/rspec/core/extensions/instance_eval_with_args.rb +0 -44
  148. data/lib/rspec/core/extensions/kernel.rb +0 -9
  149. data/lib/rspec/core/extensions/module_eval_with_args.rb +0 -38
  150. data/lib/rspec/core/extensions/ordered.rb +0 -21
  151. data/lib/rspec/core/extensions.rb +0 -4
  152. data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -34
  153. data/lib/rspec/core/let.rb +0 -110
  154. data/lib/rspec/core/load_path.rb +0 -3
  155. data/lib/rspec/core/metadata_hash_builder.rb +0 -97
  156. data/lib/rspec/core/mocking/with_absolutely_nothing.rb +0 -11
  157. data/lib/rspec/core/mocking/with_flexmock.rb +0 -27
  158. data/lib/rspec/core/mocking/with_mocha.rb +0 -29
  159. data/lib/rspec/core/mocking/with_rr.rb +0 -27
  160. data/lib/rspec/core/mocking/with_rspec.rb +0 -23
  161. data/lib/rspec/core/subject.rb +0 -219
  162. data/spec/autotest/discover_spec.rb +0 -19
  163. data/spec/autotest/failed_results_re_spec.rb +0 -45
  164. data/spec/autotest/rspec_spec.rb +0 -123
  165. data/spec/command_line/order_spec.rb +0 -137
  166. data/spec/rspec/core/command_line_spec.rb +0 -108
  167. data/spec/rspec/core/command_line_spec_output.txt +0 -0
  168. data/spec/rspec/core/configuration_options_spec.rb +0 -377
  169. data/spec/rspec/core/configuration_spec.rb +0 -1196
  170. data/spec/rspec/core/deprecations_spec.rb +0 -66
  171. data/spec/rspec/core/drb_command_line_spec.rb +0 -108
  172. data/spec/rspec/core/drb_options_spec.rb +0 -180
  173. data/spec/rspec/core/dsl_spec.rb +0 -17
  174. data/spec/rspec/core/example_group_spec.rb +0 -1098
  175. data/spec/rspec/core/example_spec.rb +0 -370
  176. data/spec/rspec/core/filter_manager_spec.rb +0 -256
  177. data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -80
  178. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +0 -363
  179. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +0 -88
  180. data/spec/rspec/core/formatters/helpers_spec.rb +0 -66
  181. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +0 -410
  182. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +0 -409
  183. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +0 -416
  184. data/spec/rspec/core/formatters/html_formatted-1.9.3.html +0 -416
  185. data/spec/rspec/core/formatters/html_formatter_spec.rb +0 -82
  186. data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -30
  187. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +0 -18
  188. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +0 -410
  189. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +0 -409
  190. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +0 -416
  191. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +0 -416
  192. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -83
  193. data/spec/rspec/core/hooks_filtering_spec.rb +0 -227
  194. data/spec/rspec/core/hooks_spec.rb +0 -250
  195. data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
  196. data/spec/rspec/core/let_spec.rb +0 -55
  197. data/spec/rspec/core/metadata_spec.rb +0 -447
  198. data/spec/rspec/core/option_parser_spec.rb +0 -166
  199. data/spec/rspec/core/pending_example_spec.rb +0 -220
  200. data/spec/rspec/core/project_initializer_spec.rb +0 -130
  201. data/spec/rspec/core/rake_task_spec.rb +0 -138
  202. data/spec/rspec/core/reporter_spec.rb +0 -103
  203. data/spec/rspec/core/resources/a_bar.rb +0 -0
  204. data/spec/rspec/core/resources/a_foo.rb +0 -0
  205. data/spec/rspec/core/resources/a_spec.rb +0 -1
  206. data/spec/rspec/core/resources/custom_example_group_runner.rb +0 -14
  207. data/spec/rspec/core/resources/formatter_specs.rb +0 -60
  208. data/spec/rspec/core/resources/utf8_encoded.rb +0 -8
  209. data/spec/rspec/core/rspec_matchers_spec.rb +0 -45
  210. data/spec/rspec/core/ruby_project_spec.rb +0 -24
  211. data/spec/rspec/core/runner_spec.rb +0 -81
  212. data/spec/rspec/core/shared_context_spec.rb +0 -67
  213. data/spec/rspec/core/shared_example_group_spec.rb +0 -84
  214. data/spec/rspec/core/subject_spec.rb +0 -244
  215. data/spec/rspec/core/world_spec.rb +0 -144
  216. data/spec/rspec/core_spec.rb +0 -35
  217. data/spec/spec_helper.rb +0 -98
  218. data/spec/support/config_options_helper.rb +0 -24
  219. data/spec/support/helper_methods.rb +0 -5
  220. data/spec/support/matchers.rb +0 -65
  221. data/spec/support/shared_example_groups.rb +0 -41
  222. data/spec/support/spec_files.rb +0 -44
@@ -1,416 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
- <head>
7
- <title>RSpec results</title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
- <meta http-equiv="Expires" content="-1" />
10
- <meta http-equiv="Pragma" content="no-cache" />
11
- <style type="text/css">
12
- body {
13
- margin: 0;
14
- padding: 0;
15
- background: #fff;
16
- font-size: 80%;
17
- }
18
- </style>
19
- <script type="text/javascript">
20
- // <![CDATA[
21
-
22
- function addClass(element_id, classname) {
23
- document.getElementById(element_id).className += (" " + classname);
24
- }
25
-
26
- function removeClass(element_id, classname) {
27
- var elem = document.getElementById(element_id);
28
- var classlist = elem.className.replace(classname,'');
29
- elem.className = classlist;
30
- }
31
-
32
- function moveProgressBar(percentDone) {
33
- document.getElementById("rspec-header").style.width = percentDone +"%";
34
- }
35
-
36
- function makeRed(element_id) {
37
- removeClass(element_id, 'passed');
38
- removeClass(element_id, 'not_implemented');
39
- addClass(element_id,'failed');
40
- }
41
-
42
- function makeYellow(element_id) {
43
- var elem = document.getElementById(element_id);
44
- if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
45
- if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
46
- removeClass(element_id, 'passed');
47
- addClass(element_id,'not_implemented');
48
- }
49
- }
50
- }
51
-
52
- function apply_filters() {
53
- var passed_filter = document.getElementById('passed_checkbox').checked;
54
- var failed_filter = document.getElementById('failed_checkbox').checked;
55
- var pending_filter = document.getElementById('pending_checkbox').checked;
56
-
57
- assign_display_style("example passed", passed_filter);
58
- assign_display_style("example failed", failed_filter);
59
- assign_display_style("example not_implemented", pending_filter);
60
-
61
- assign_display_style_for_group("example_group passed", passed_filter);
62
- assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
63
- assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
64
- }
65
-
66
- function get_display_style(display_flag) {
67
- var style_mode = 'none';
68
- if (display_flag == true) {
69
- style_mode = 'block';
70
- }
71
- return style_mode;
72
- }
73
-
74
- function assign_display_style(classname, display_flag) {
75
- var style_mode = get_display_style(display_flag);
76
- var elems = document.getElementsByClassName(classname)
77
- for (var i=0; i<elems.length;i++) {
78
- elems[i].style.display = style_mode;
79
- }
80
- }
81
-
82
- function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
83
- var display_style_mode = get_display_style(display_flag);
84
- var subgroup_style_mode = get_display_style(subgroup_flag);
85
- var elems = document.getElementsByClassName(classname)
86
- for (var i=0; i<elems.length;i++) {
87
- var style_mode = display_style_mode;
88
- if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
89
- elems[i].style.display = subgroup_style_mode;
90
- } else {
91
- elems[i].style.display = display_style_mode;
92
- }
93
- }
94
- }
95
-
96
- // ]]>
97
- </script>
98
- <style type="text/css">
99
- #rspec-header {
100
- background: #65C400; color: #fff; height: 4em;
101
- }
102
-
103
- .rspec-report h1 {
104
- margin: 0px 10px 0px 10px;
105
- padding: 10px;
106
- font-family: "Lucida Grande", Helvetica, sans-serif;
107
- font-size: 1.8em;
108
- position: absolute;
109
- }
110
-
111
- #label {
112
- float:left;
113
- }
114
-
115
- #display-filters {
116
- float:left;
117
- padding: 28px 0 0 40%;
118
- font-family: "Lucida Grande", Helvetica, sans-serif;
119
- }
120
-
121
- #summary {
122
- float:right;
123
- padding: 5px 10px;
124
- font-family: "Lucida Grande", Helvetica, sans-serif;
125
- text-align: right;
126
- }
127
-
128
- #summary p {
129
- margin: 0 0 0 2px;
130
- }
131
-
132
- #summary #totals {
133
- font-size: 1.2em;
134
- }
135
-
136
- .example_group {
137
- margin: 0 10px 5px;
138
- background: #fff;
139
- }
140
-
141
- dl {
142
- margin: 0; padding: 0 0 5px;
143
- font: normal 11px "Lucida Grande", Helvetica, sans-serif;
144
- }
145
-
146
- dt {
147
- padding: 3px;
148
- background: #65C400;
149
- color: #fff;
150
- font-weight: bold;
151
- }
152
-
153
- dd {
154
- margin: 5px 0 5px 5px;
155
- padding: 3px 3px 3px 18px;
156
- }
157
-
158
- dd .duration {
159
- padding-left: 5px;
160
- text-align: right;
161
- right: 0px;
162
- float:right;
163
- }
164
-
165
- dd.example.passed {
166
- border-left: 5px solid #65C400;
167
- border-bottom: 1px solid #65C400;
168
- background: #DBFFB4; color: #3D7700;
169
- }
170
-
171
- dd.example.not_implemented {
172
- border-left: 5px solid #FAF834;
173
- border-bottom: 1px solid #FAF834;
174
- background: #FCFB98; color: #131313;
175
- }
176
-
177
- dd.example.pending_fixed {
178
- border-left: 5px solid #0000C2;
179
- border-bottom: 1px solid #0000C2;
180
- color: #0000C2; background: #D3FBFF;
181
- }
182
-
183
- dd.example.failed {
184
- border-left: 5px solid #C20000;
185
- border-bottom: 1px solid #C20000;
186
- color: #C20000; background: #FFFBD3;
187
- }
188
-
189
-
190
- dt.not_implemented {
191
- color: #000000; background: #FAF834;
192
- }
193
-
194
- dt.pending_fixed {
195
- color: #FFFFFF; background: #C40D0D;
196
- }
197
-
198
- dt.failed {
199
- color: #FFFFFF; background: #C40D0D;
200
- }
201
-
202
-
203
- #rspec-header.not_implemented {
204
- color: #000000; background: #FAF834;
205
- }
206
-
207
- #rspec-header.pending_fixed {
208
- color: #FFFFFF; background: #C40D0D;
209
- }
210
-
211
- #rspec-header.failed {
212
- color: #FFFFFF; background: #C40D0D;
213
- }
214
-
215
-
216
- .backtrace {
217
- color: #000;
218
- font-size: 12px;
219
- }
220
-
221
- a {
222
- color: #BE5C00;
223
- }
224
-
225
- /* Ruby code, style similar to vibrant ink */
226
- .ruby {
227
- font-size: 12px;
228
- font-family: monospace;
229
- color: white;
230
- background-color: black;
231
- padding: 0.1em 0 0.2em 0;
232
- }
233
-
234
- .ruby .keyword { color: #FF6600; }
235
- .ruby .constant { color: #339999; }
236
- .ruby .attribute { color: white; }
237
- .ruby .global { color: white; }
238
- .ruby .module { color: white; }
239
- .ruby .class { color: white; }
240
- .ruby .string { color: #66FF00; }
241
- .ruby .ident { color: white; }
242
- .ruby .method { color: #FFCC00; }
243
- .ruby .number { color: white; }
244
- .ruby .char { color: white; }
245
- .ruby .comment { color: #9933CC; }
246
- .ruby .symbol { color: white; }
247
- .ruby .regex { color: #44B4CC; }
248
- .ruby .punct { color: white; }
249
- .ruby .escape { color: white; }
250
- .ruby .interp { color: white; }
251
- .ruby .expr { color: white; }
252
-
253
- .ruby .offending { background-color: gray; }
254
- .ruby .linenum {
255
- width: 75px;
256
- padding: 0.1em 1em 0.2em 0;
257
- color: #000000;
258
- background-color: #FFFBD3;
259
- }
260
-
261
- </style>
262
- </head>
263
- <body>
264
- <div class="rspec-report">
265
-
266
- <div id="rspec-header">
267
- <div id="label">
268
- <h1>RSpec Code Examples</h1>
269
- </div>
270
-
271
- <div id="display-filters">
272
- <input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
273
- <input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
274
- <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
275
- </div>
276
-
277
- <div id="summary">
278
- <p id="totals">&nbsp;</p>
279
- <p id="duration">&nbsp;</p>
280
- </div>
281
- </div>
282
-
283
-
284
- <div class="results">
285
- <div id="div_group_1" class="example_group passed">
286
- <dl style="margin-left: 0px;">
287
- <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
288
- <script type="text/javascript">makeYellow('rspec-header');</script>
289
- <script type="text/javascript">makeYellow('div_group_1');</script>
290
- <script type="text/javascript">makeYellow('example_group_1');</script>
291
- <script type="text/javascript">moveProgressBar('14.2');</script>
292
- <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
293
- </dl>
294
- </div>
295
- <div id="div_group_2" class="example_group passed">
296
- <dl style="margin-left: 0px;">
297
- <dt id="example_group_2" class="passed">pending command with block format</dt>
298
- </dl>
299
- </div>
300
- <div id="div_group_3" class="example_group passed">
301
- <dl style="margin-left: 15px;">
302
- <dt id="example_group_3" class="passed">with content that would fail</dt>
303
- <script type="text/javascript">makeYellow('rspec-header');</script>
304
- <script type="text/javascript">makeYellow('div_group_3');</script>
305
- <script type="text/javascript">makeYellow('example_group_3');</script>
306
- <script type="text/javascript">moveProgressBar('28.5');</script>
307
- <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
308
- </dl>
309
- </div>
310
- <div id="div_group_4" class="example_group passed">
311
- <dl style="margin-left: 15px;">
312
- <dt id="example_group_4" class="passed">with content that would pass</dt>
313
- <script type="text/javascript">makeRed('rspec-header');</script>
314
- <script type="text/javascript">makeRed('div_group_4');</script>
315
- <script type="text/javascript">makeRed('example_group_4');</script>
316
- <script type="text/javascript">moveProgressBar('42.8');</script>
317
- <dd class="example pending_fixed">
318
- <span class="failed_spec_name">fails</span>
319
- <span class="duration">n.nnnns</span>
320
- <div class="failure" id="failure_1">
321
- <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
322
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
323
- ./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
324
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
325
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
326
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
327
- ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
328
- ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
329
- <pre class="ruby"><code><span class="linenum">16</span> <span class="ident">context</span> <span class="punct">&quot;</span><span class="string">with content that would pass</span><span class="punct">&quot;</span> <span class="keyword">do</span>
330
- <span class="linenum">17</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">fails</span><span class="punct">&quot;</span> <span class="keyword">do</span>
331
- <span class="offending"><span class="linenum">18</span> <span class="ident">pending</span> <span class="keyword">do</span></span>
332
- <span class="linenum">19</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
333
- <span class="linenum">20</span> <span class="keyword">end</span></code></pre>
334
- </div>
335
- </dd>
336
- </dl>
337
- </div>
338
- <div id="div_group_5" class="example_group passed">
339
- <dl style="margin-left: 0px;">
340
- <dt id="example_group_5" class="passed">passing spec</dt>
341
- <script type="text/javascript">moveProgressBar('57.1');</script>
342
- <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
343
- </dl>
344
- </div>
345
- <div id="div_group_6" class="example_group passed">
346
- <dl style="margin-left: 0px;">
347
- <dt id="example_group_6" class="passed">failing spec</dt>
348
- <script type="text/javascript">makeRed('div_group_6');</script>
349
- <script type="text/javascript">makeRed('example_group_6');</script>
350
- <script type="text/javascript">moveProgressBar('71.4');</script>
351
- <dd class="example failed">
352
- <span class="failed_spec_name">fails</span>
353
- <span class="duration">n.nnnns</span>
354
- <div class="failure" id="failure_2">
355
- <div class="message"><pre>
356
- expected: 2
357
- got: 1
358
-
359
- (compared using ==)
360
- </pre></div>
361
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `block (2 levels) in <top (required)>'
362
- ./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
363
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
364
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
365
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
366
- ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
367
- ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
368
- <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">&quot;</span><span class="string">failing spec</span><span class="punct">&quot;</span> <span class="keyword">do</span>
369
- <span class="linenum">32</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">fails</span><span class="punct">&quot;</span> <span class="keyword">do</span>
370
- <span class="offending"><span class="linenum">33</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
371
- <span class="linenum">34</span> <span class="keyword">end</span>
372
- <span class="linenum">35</span><span class="keyword">end</span></code></pre>
373
- </div>
374
- </dd>
375
- </dl>
376
- </div>
377
- <div id="div_group_7" class="example_group passed">
378
- <dl style="margin-left: 0px;">
379
- <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
380
- <script type="text/javascript">makeRed('div_group_7');</script>
381
- <script type="text/javascript">makeRed('example_group_7');</script>
382
- <script type="text/javascript">moveProgressBar('85.7');</script>
383
- <dd class="example failed">
384
- <span class="failed_spec_name">fails with a backtrace that has no file</span>
385
- <span class="duration">n.nnnns</span>
386
- <div class="failure" id="failure_3">
387
- <div class="message"><pre>foo</pre></div>
388
- <div class="backtrace"><pre>(erb):1:in `<main>'
389
- ./spec/rspec/core/resources/formatter_specs.rb:41:in `block (2 levels) in <top (required)>'
390
- ./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
391
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
392
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
393
- ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
394
- ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
395
- ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
396
- <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
397
- </div>
398
- </dd>
399
- <script type="text/javascript">moveProgressBar('100.0');</script>
400
- <dd class="example failed">
401
- <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
402
- <span class="duration">n.nnnns</span>
403
- <div class="failure" id="failure_4">
404
- <div class="message"><pre>Exception</pre></div>
405
- <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
406
- <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
407
- </div>
408
- </dd>
409
- </dl>
410
- </div>
411
- <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
412
- <script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
413
- </div>
414
- </div>
415
- </body>
416
- </html>
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
- require 'rspec/core/formatters/html_formatter'
3
- require 'nokogiri'
4
-
5
- module RSpec
6
- module Core
7
- module Formatters
8
- describe HtmlFormatter, :if => RUBY_VERSION =~ /^(1.8.7|1.9.2|1.9.3)$/ do
9
- let(:jruby?) { ::RUBY_PLATFORM == 'java' }
10
- let(:root) { File.expand_path("#{File.dirname(__FILE__)}/../../../..") }
11
- let(:suffix) { jruby? ? '-jruby' : '' }
12
-
13
- let(:expected_file) do
14
- "#{File.dirname(__FILE__)}/html_formatted-#{::RUBY_VERSION}#{suffix}.html"
15
- end
16
-
17
- let(:generated_html) do
18
- options = RSpec::Core::ConfigurationOptions.new(
19
- %w[spec/rspec/core/resources/formatter_specs.rb --format html --order default]
20
- )
21
- options.parse_options
22
- err, out = StringIO.new, StringIO.new
23
- command_line = RSpec::Core::CommandLine.new(options)
24
- command_line.run(err, out)
25
- out.string.gsub(/\d+\.\d+(s| seconds)/, "n.nnnn\\1")
26
- end
27
-
28
- let(:expected_html) do
29
- unless File.file?(expected_file)
30
- raise "There is no HTML file with expected content for this platform: #{expected_file}"
31
- end
32
- File.read(expected_file)
33
- end
34
-
35
- before do
36
- RSpec.configuration.stub(:load_spec_files) do
37
- RSpec.configuration.files_to_run.map {|f| load File.expand_path(f) }
38
- end
39
- end
40
-
41
- # Uncomment this group temporarily in order to overwrite the expected
42
- # with actual. Use with care!!!
43
- describe "file generator", :if => ENV['GENERATE'] do
44
- it "generates a new comparison file" do
45
- Dir.chdir(root) do
46
- File.open(expected_file, 'w') {|io| io.write(generated_html)}
47
- end
48
- end
49
- end
50
-
51
- def extract_backtrace_from(doc)
52
- doc.search("div.backtrace").
53
- collect {|e| e.at("pre").inner_html}.
54
- collect {|e| e.split("\n")}.flatten.
55
- select {|e| e =~ /formatter_specs\.rb/}
56
- end
57
-
58
- it "produces HTML identical to the one we designed manually" do
59
- Dir.chdir(root) do
60
- actual_doc = Nokogiri::HTML(generated_html)
61
- actual_backtraces = extract_backtrace_from(actual_doc)
62
- actual_doc.css("div.backtrace").remove
63
-
64
- expected_doc = Nokogiri::HTML(expected_html)
65
- expected_backtraces = extract_backtrace_from(expected_doc)
66
- expected_doc.search("div.backtrace").remove
67
-
68
- actual_doc.inner_html.should eq(expected_doc.inner_html)
69
-
70
- expected_backtraces.each_with_index do |expected_line, i|
71
- expected_path, expected_line_number, expected_suffix = expected_line.split(':')
72
- actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
73
- File.expand_path(actual_path).should eq(File.expand_path(expected_path))
74
- actual_line_number.should eq(expected_line_number)
75
- actual_suffix.should eq(expected_suffix)
76
- end
77
- end
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
- require 'rspec/core/formatters/progress_formatter'
3
-
4
- describe RSpec::Core::Formatters::ProgressFormatter do
5
-
6
- before do
7
- @output = StringIO.new
8
- @formatter = RSpec::Core::Formatters::ProgressFormatter.new(@output)
9
- @formatter.start(2)
10
- @formatter.stub!(:color_enabled?).and_return(false)
11
- end
12
-
13
- it "produces line break on start dump" do
14
- @formatter.start_dump
15
- @output.string.should eq("\n")
16
- end
17
-
18
- it "produces standard summary without pending when pending has a 0 count" do
19
- @formatter.start_dump
20
- @formatter.dump_summary(0.00001, 2, 0, 0)
21
- @output.string.should =~ /2 examples, 0 failures/i
22
- @output.string.should_not =~ /0 pending/i
23
- end
24
-
25
- it "pushes nothing on start" do
26
- @formatter.start(4)
27
- @output.string.should eq("")
28
- end
29
-
30
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
- require 'rspec/core/formatters/snippet_extractor'
3
-
4
- module RSpec
5
- module Core
6
- module Formatters
7
- describe SnippetExtractor do
8
- it "falls back on a default message when it doesn't understand a line" do
9
- RSpec::Core::Formatters::SnippetExtractor.new.snippet_for("blech").should eq(["# Couldn't get snippet for blech", 1])
10
- end
11
-
12
- it "falls back on a default message when it doesn't find the file" do
13
- RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8).should eq("# Couldn't get snippet for blech")
14
- end
15
- end
16
- end
17
- end
18
- end