rspec-core 2.99.0 → 3.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.
Files changed (216) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.sig +0 -0
  3. data/.yardopts +1 -0
  4. data/Changelog.md +339 -1
  5. data/License.txt +1 -0
  6. data/README.md +19 -37
  7. data/exe/rspec +2 -23
  8. data/lib/rspec/core/backport_random.rb +336 -0
  9. data/lib/rspec/core/backtrace_formatter.rb +70 -0
  10. data/lib/rspec/core/configuration.rb +479 -577
  11. data/lib/rspec/core/configuration_options.rb +71 -54
  12. data/lib/rspec/core/drb.rb +111 -0
  13. data/lib/rspec/core/dsl.rb +86 -18
  14. data/lib/rspec/core/example.rb +267 -119
  15. data/lib/rspec/core/example_group.rb +381 -393
  16. data/lib/rspec/core/filter_manager.rb +133 -114
  17. data/lib/rspec/core/flat_map.rb +18 -0
  18. data/lib/rspec/core/formatters/base_formatter.rb +51 -125
  19. data/lib/rspec/core/formatters/base_text_formatter.rb +34 -286
  20. data/lib/rspec/core/formatters/console_codes.rb +24 -1
  21. data/lib/rspec/core/formatters/deprecation_formatter.rb +25 -26
  22. data/lib/rspec/core/formatters/documentation_formatter.rb +27 -25
  23. data/lib/rspec/core/formatters/helpers.rb +14 -36
  24. data/lib/rspec/core/formatters/html_formatter.rb +58 -65
  25. data/lib/rspec/core/formatters/html_printer.rb +12 -18
  26. data/lib/rspec/core/formatters/json_formatter.rb +54 -31
  27. data/lib/rspec/core/formatters/profile_formatter.rb +67 -0
  28. data/lib/rspec/core/formatters/progress_formatter.rb +11 -15
  29. data/lib/rspec/core/formatters/snippet_extractor.rb +22 -11
  30. data/lib/rspec/core/formatters.rb +90 -43
  31. data/lib/rspec/core/hooks.rb +325 -270
  32. data/lib/rspec/core/memoized_helpers.rb +45 -156
  33. data/lib/rspec/core/metadata.rb +284 -236
  34. data/lib/rspec/core/metadata_filter.rb +86 -0
  35. data/lib/rspec/core/mocking_adapters/flexmock.rb +29 -0
  36. data/lib/rspec/core/{mocking/with_mocha.rb → mocking_adapters/mocha.rb} +19 -16
  37. data/lib/rspec/core/mocking_adapters/null.rb +12 -0
  38. data/lib/rspec/core/mocking_adapters/rr.rb +29 -0
  39. data/lib/rspec/core/mocking_adapters/rspec.rb +30 -0
  40. data/lib/rspec/core/notifications.rb +511 -0
  41. data/lib/rspec/core/option_parser.rb +49 -74
  42. data/lib/rspec/core/ordering.rb +156 -0
  43. data/lib/rspec/core/pending.rb +94 -96
  44. data/lib/rspec/core/project_initializer/.rspec +3 -0
  45. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +78 -0
  46. data/lib/rspec/core/project_initializer.rb +24 -64
  47. data/lib/rspec/core/rake_task.rb +44 -130
  48. data/lib/rspec/core/reporter.rb +76 -59
  49. data/lib/rspec/core/ruby_project.rb +2 -1
  50. data/lib/rspec/core/runner.rb +117 -52
  51. data/lib/rspec/core/shared_context.rb +10 -10
  52. data/lib/rspec/core/shared_example_group.rb +108 -121
  53. data/lib/rspec/core/version.rb +3 -1
  54. data/lib/rspec/core/warnings.rb +40 -0
  55. data/lib/rspec/core/world.rb +66 -10
  56. data/lib/rspec/core.rb +64 -104
  57. data.tar.gz.sig +3 -0
  58. metadata +75 -322
  59. metadata.gz.sig +1 -0
  60. data/exe/autospec +0 -13
  61. data/features/Autotest.md +0 -38
  62. data/features/README.md +0 -17
  63. data/features/Upgrade.md +0 -364
  64. data/features/command_line/README.md +0 -28
  65. data/features/command_line/example_name_option.feature +0 -97
  66. data/features/command_line/exit_status.feature +0 -82
  67. data/features/command_line/format_option.feature +0 -75
  68. data/features/command_line/init.feature +0 -18
  69. data/features/command_line/line_number_appended_to_path.feature +0 -140
  70. data/features/command_line/line_number_option.feature +0 -53
  71. data/features/command_line/order.feature +0 -26
  72. data/features/command_line/pattern_option.feature +0 -49
  73. data/features/command_line/rake_task.feature +0 -122
  74. data/features/command_line/require_option.feature +0 -43
  75. data/features/command_line/ruby.feature +0 -22
  76. data/features/command_line/tag.feature +0 -98
  77. data/features/command_line/warnings_option.feature +0 -29
  78. data/features/configuration/alias_example_to.feature +0 -48
  79. data/features/configuration/backtrace_clean_patterns.feature +0 -102
  80. data/features/configuration/custom_settings.feature +0 -84
  81. data/features/configuration/default_path.feature +0 -38
  82. data/features/configuration/deprecation_stream.feature +0 -58
  83. data/features/configuration/fail_fast.feature +0 -77
  84. data/features/configuration/failure_exit_code.feature +0 -36
  85. data/features/configuration/order_and_seed.feature +0 -3
  86. data/features/configuration/output_stream.feature +0 -24
  87. data/features/configuration/pattern.feature +0 -38
  88. data/features/configuration/profile.feature +0 -220
  89. data/features/configuration/read_options_from_file.feature +0 -90
  90. data/features/configuration/run_all_when_everything_filtered.feature +0 -76
  91. data/features/configuration/show_failures_in_pending_blocks.feature +0 -61
  92. data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +0 -52
  93. data/features/example_groups/basic_structure.feature +0 -55
  94. data/features/example_groups/shared_context.feature +0 -74
  95. data/features/example_groups/shared_examples.feature +0 -294
  96. data/features/expectation_framework_integration/configure_expectation_framework.feature +0 -197
  97. data/features/filtering/exclusion_filters.feature +0 -138
  98. data/features/filtering/if_and_unless.feature +0 -168
  99. data/features/filtering/inclusion_filters.feature +0 -105
  100. data/features/formatters/configurable_colors.feature +0 -31
  101. data/features/formatters/custom_formatter.feature +0 -36
  102. data/features/formatters/json_formatter.feature +0 -30
  103. data/features/formatters/text_formatter.feature +0 -46
  104. data/features/helper_methods/arbitrary_methods.feature +0 -40
  105. data/features/helper_methods/let.feature +0 -50
  106. data/features/helper_methods/modules.feature +0 -149
  107. data/features/hooks/around_hooks.feature +0 -343
  108. data/features/hooks/before_and_after_hooks.feature +0 -427
  109. data/features/hooks/filtering.feature +0 -234
  110. data/features/metadata/current_example.feature +0 -56
  111. data/features/metadata/described_class.feature +0 -17
  112. data/features/metadata/user_defined.feature +0 -113
  113. data/features/mock_framework_integration/use_any_framework.feature +0 -106
  114. data/features/mock_framework_integration/use_flexmock.feature +0 -96
  115. data/features/mock_framework_integration/use_mocha.feature +0 -97
  116. data/features/mock_framework_integration/use_rr.feature +0 -98
  117. data/features/mock_framework_integration/use_rspec.feature +0 -97
  118. data/features/pending/pending_examples.feature +0 -229
  119. data/features/spec_files/arbitrary_file_suffix.feature +0 -13
  120. data/features/step_definitions/additional_cli_steps.rb +0 -49
  121. data/features/subject/attribute_of_subject.feature +0 -124
  122. data/features/subject/explicit_subject.feature +0 -101
  123. data/features/subject/implicit_subject.feature +0 -63
  124. data/features/subject/one_liner_syntax.feature +0 -71
  125. data/features/support/env.rb +0 -14
  126. data/features/support/rubinius.rb +0 -6
  127. data/lib/autotest/discover.rb +0 -10
  128. data/lib/autotest/rspec2.rb +0 -77
  129. data/lib/rspec/core/backtrace_cleaner.rb +0 -46
  130. data/lib/rspec/core/backward_compatibility.rb +0 -55
  131. data/lib/rspec/core/caller_filter.rb +0 -60
  132. data/lib/rspec/core/command_line.rb +0 -47
  133. data/lib/rspec/core/deprecated_mutable_array_proxy.rb +0 -32
  134. data/lib/rspec/core/deprecation.rb +0 -26
  135. data/lib/rspec/core/drb_command_line.rb +0 -26
  136. data/lib/rspec/core/drb_options.rb +0 -87
  137. data/lib/rspec/core/extensions/instance_eval_with_args.rb +0 -44
  138. data/lib/rspec/core/extensions/kernel.rb +0 -9
  139. data/lib/rspec/core/extensions/module_eval_with_args.rb +0 -38
  140. data/lib/rspec/core/extensions/ordered.rb +0 -27
  141. data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -34
  142. data/lib/rspec/core/metadata_hash_builder.rb +0 -97
  143. data/lib/rspec/core/mocking/with_absolutely_nothing.rb +0 -11
  144. data/lib/rspec/core/mocking/with_flexmock.rb +0 -27
  145. data/lib/rspec/core/mocking/with_rr.rb +0 -27
  146. data/lib/rspec/core/mocking/with_rspec.rb +0 -27
  147. data/lib/rspec/core/shared_example_group/collection.rb +0 -45
  148. data/spec/autotest/discover_spec.rb +0 -49
  149. data/spec/autotest/failed_results_re_spec.rb +0 -45
  150. data/spec/autotest/rspec_spec.rb +0 -133
  151. data/spec/command_line/order_spec.rb +0 -204
  152. data/spec/rspec/core/backtrace_cleaner_spec.rb +0 -68
  153. data/spec/rspec/core/caller_filter_spec.rb +0 -58
  154. data/spec/rspec/core/command_line_spec.rb +0 -127
  155. data/spec/rspec/core/command_line_spec_output.txt +0 -0
  156. data/spec/rspec/core/configuration_options_spec.rb +0 -417
  157. data/spec/rspec/core/configuration_spec.rb +0 -2072
  158. data/spec/rspec/core/deprecation_spec.rb +0 -27
  159. data/spec/rspec/core/deprecations_spec.rb +0 -59
  160. data/spec/rspec/core/drb_command_line_spec.rb +0 -102
  161. data/spec/rspec/core/drb_options_spec.rb +0 -193
  162. data/spec/rspec/core/dsl_spec.rb +0 -25
  163. data/spec/rspec/core/example_group_spec.rb +0 -1337
  164. data/spec/rspec/core/example_spec.rb +0 -502
  165. data/spec/rspec/core/filter_manager_spec.rb +0 -246
  166. data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -108
  167. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +0 -524
  168. data/spec/rspec/core/formatters/console_codes_spec.rb +0 -50
  169. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +0 -263
  170. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +0 -89
  171. data/spec/rspec/core/formatters/helpers_spec.rb +0 -104
  172. data/spec/rspec/core/formatters/html_formatted.html +0 -397
  173. data/spec/rspec/core/formatters/html_formatter_spec.rb +0 -131
  174. data/spec/rspec/core/formatters/json_formatter_spec.rb +0 -115
  175. data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -30
  176. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +0 -26
  177. data/spec/rspec/core/formatters/text_mate_formatted.html +0 -397
  178. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -107
  179. data/spec/rspec/core/hooks_filtering_spec.rb +0 -227
  180. data/spec/rspec/core/hooks_spec.rb +0 -269
  181. data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
  182. data/spec/rspec/core/memoized_helpers_spec.rb +0 -776
  183. data/spec/rspec/core/metadata_spec.rb +0 -514
  184. data/spec/rspec/core/option_parser_spec.rb +0 -297
  185. data/spec/rspec/core/pending_example_spec.rb +0 -260
  186. data/spec/rspec/core/pending_spec.rb +0 -27
  187. data/spec/rspec/core/project_initializer_spec.rb +0 -130
  188. data/spec/rspec/core/rake_task_spec.rb +0 -202
  189. data/spec/rspec/core/reporter_spec.rb +0 -167
  190. data/spec/rspec/core/resources/a_bar.rb +0 -0
  191. data/spec/rspec/core/resources/a_foo.rb +0 -0
  192. data/spec/rspec/core/resources/a_spec.rb +0 -1
  193. data/spec/rspec/core/resources/custom_example_group_runner.rb +0 -14
  194. data/spec/rspec/core/resources/formatter_specs.rb +0 -60
  195. data/spec/rspec/core/resources/utf8_encoded.rb +0 -8
  196. data/spec/rspec/core/rspec_matchers_spec.rb +0 -45
  197. data/spec/rspec/core/ruby_project_spec.rb +0 -26
  198. data/spec/rspec/core/runner_spec.rb +0 -82
  199. data/spec/rspec/core/shared_context_spec.rb +0 -114
  200. data/spec/rspec/core/shared_example_group/collection_spec.rb +0 -70
  201. data/spec/rspec/core/shared_example_group_spec.rb +0 -138
  202. data/spec/rspec/core/world_spec.rb +0 -142
  203. data/spec/rspec/core_spec.rb +0 -108
  204. data/spec/spec_helper.rb +0 -135
  205. data/spec/support/config_options_helper.rb +0 -15
  206. data/spec/support/helper_methods.rb +0 -55
  207. data/spec/support/in_sub_process.rb +0 -37
  208. data/spec/support/isolate_load_path_mutation.rb +0 -6
  209. data/spec/support/isolated_directory.rb +0 -10
  210. data/spec/support/isolated_home_directory.rb +0 -16
  211. data/spec/support/matchers.rb +0 -65
  212. data/spec/support/mathn_integration_support.rb +0 -12
  213. data/spec/support/sandboxed_mock_space.rb +0 -116
  214. data/spec/support/shared_example_groups.rb +0 -42
  215. data/spec/support/silence_dsl_deprecations.rb +0 -32
  216. data/spec/support/spec_files.rb +0 -44
@@ -1,397 +0,0 @@
1
- <html lang="en">
2
- <head>
3
- <title>RSpec results</title>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta http-equiv="Expires" content="-1">
6
- <meta http-equiv="Pragma" content="no-cache">
7
- <style type="text/css">
8
- body {
9
- margin: 0;
10
- padding: 0;
11
- background: #fff;
12
- font-size: 80%;
13
- }
14
- </style>
15
- <script type="text/javascript">
16
- // <![CDATA[
17
-
18
- function addClass(element_id, classname) {
19
- document.getElementById(element_id).className += (" " + classname);
20
- }
21
-
22
- function removeClass(element_id, classname) {
23
- var elem = document.getElementById(element_id);
24
- var classlist = elem.className.replace(classname,'');
25
- elem.className = classlist;
26
- }
27
-
28
- function moveProgressBar(percentDone) {
29
- document.getElementById("rspec-header").style.width = percentDone +"%";
30
- }
31
-
32
- function makeRed(element_id) {
33
- removeClass(element_id, 'passed');
34
- removeClass(element_id, 'not_implemented');
35
- addClass(element_id,'failed');
36
- }
37
-
38
- function makeYellow(element_id) {
39
- var elem = document.getElementById(element_id);
40
- if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
41
- if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
42
- removeClass(element_id, 'passed');
43
- addClass(element_id,'not_implemented');
44
- }
45
- }
46
- }
47
-
48
- function apply_filters() {
49
- var passed_filter = document.getElementById('passed_checkbox').checked;
50
- var failed_filter = document.getElementById('failed_checkbox').checked;
51
- var pending_filter = document.getElementById('pending_checkbox').checked;
52
-
53
- assign_display_style("example passed", passed_filter);
54
- assign_display_style("example failed", failed_filter);
55
- assign_display_style("example not_implemented", pending_filter);
56
-
57
- assign_display_style_for_group("example_group passed", passed_filter);
58
- assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
59
- assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
60
- }
61
-
62
- function get_display_style(display_flag) {
63
- var style_mode = 'none';
64
- if (display_flag == true) {
65
- style_mode = 'block';
66
- }
67
- return style_mode;
68
- }
69
-
70
- function assign_display_style(classname, display_flag) {
71
- var style_mode = get_display_style(display_flag);
72
- var elems = document.getElementsByClassName(classname)
73
- for (var i=0; i<elems.length;i++) {
74
- elems[i].style.display = style_mode;
75
- }
76
- }
77
-
78
- function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
79
- var display_style_mode = get_display_style(display_flag);
80
- var subgroup_style_mode = get_display_style(subgroup_flag);
81
- var elems = document.getElementsByClassName(classname)
82
- for (var i=0; i<elems.length;i++) {
83
- var style_mode = display_style_mode;
84
- if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
85
- elems[i].style.display = subgroup_style_mode;
86
- } else {
87
- elems[i].style.display = display_style_mode;
88
- }
89
- }
90
- }
91
-
92
- // ]]>
93
- </script>
94
- <style type="text/css">
95
- #rspec-header {
96
- background: #65C400; color: #fff; height: 4em;
97
- }
98
-
99
- .rspec-report h1 {
100
- margin: 0px 10px 0px 10px;
101
- padding: 10px;
102
- font-family: "Lucida Grande", Helvetica, sans-serif;
103
- font-size: 1.8em;
104
- position: absolute;
105
- }
106
-
107
- #label {
108
- float:left;
109
- }
110
-
111
- #display-filters {
112
- float:left;
113
- padding: 28px 0 0 40%;
114
- font-family: "Lucida Grande", Helvetica, sans-serif;
115
- }
116
-
117
- #summary {
118
- float:right;
119
- padding: 5px 10px;
120
- font-family: "Lucida Grande", Helvetica, sans-serif;
121
- text-align: right;
122
- }
123
-
124
- #summary p {
125
- margin: 0 0 0 2px;
126
- }
127
-
128
- #summary #totals {
129
- font-size: 1.2em;
130
- }
131
-
132
- .example_group {
133
- margin: 0 10px 5px;
134
- background: #fff;
135
- }
136
-
137
- dl {
138
- margin: 0; padding: 0 0 5px;
139
- font: normal 11px "Lucida Grande", Helvetica, sans-serif;
140
- }
141
-
142
- dt {
143
- padding: 3px;
144
- background: #65C400;
145
- color: #fff;
146
- font-weight: bold;
147
- }
148
-
149
- dd {
150
- margin: 5px 0 5px 5px;
151
- padding: 3px 3px 3px 18px;
152
- }
153
-
154
- dd .duration {
155
- padding-left: 5px;
156
- text-align: right;
157
- right: 0px;
158
- float:right;
159
- }
160
-
161
- dd.example.passed {
162
- border-left: 5px solid #65C400;
163
- border-bottom: 1px solid #65C400;
164
- background: #DBFFB4; color: #3D7700;
165
- }
166
-
167
- dd.example.not_implemented {
168
- border-left: 5px solid #FAF834;
169
- border-bottom: 1px solid #FAF834;
170
- background: #FCFB98; color: #131313;
171
- }
172
-
173
- dd.example.pending_fixed {
174
- border-left: 5px solid #0000C2;
175
- border-bottom: 1px solid #0000C2;
176
- color: #0000C2; background: #D3FBFF;
177
- }
178
-
179
- dd.example.failed {
180
- border-left: 5px solid #C20000;
181
- border-bottom: 1px solid #C20000;
182
- color: #C20000; background: #FFFBD3;
183
- }
184
-
185
-
186
- dt.not_implemented {
187
- color: #000000; background: #FAF834;
188
- }
189
-
190
- dt.pending_fixed {
191
- color: #FFFFFF; background: #C40D0D;
192
- }
193
-
194
- dt.failed {
195
- color: #FFFFFF; background: #C40D0D;
196
- }
197
-
198
-
199
- #rspec-header.not_implemented {
200
- color: #000000; background: #FAF834;
201
- }
202
-
203
- #rspec-header.pending_fixed {
204
- color: #FFFFFF; background: #C40D0D;
205
- }
206
-
207
- #rspec-header.failed {
208
- color: #FFFFFF; background: #C40D0D;
209
- }
210
-
211
-
212
- .backtrace {
213
- color: #000;
214
- font-size: 12px;
215
- }
216
-
217
- a {
218
- color: #BE5C00;
219
- }
220
-
221
- /* Ruby code, style similar to vibrant ink */
222
- .ruby {
223
- font-size: 12px;
224
- font-family: monospace;
225
- color: white;
226
- background-color: black;
227
- padding: 0.1em 0 0.2em 0;
228
- }
229
-
230
- .ruby .keyword { color: #FF6600; }
231
- .ruby .constant { color: #339999; }
232
- .ruby .attribute { color: white; }
233
- .ruby .global { color: white; }
234
- .ruby .module { color: white; }
235
- .ruby .class { color: white; }
236
- .ruby .string { color: #66FF00; }
237
- .ruby .ident { color: white; }
238
- .ruby .method { color: #FFCC00; }
239
- .ruby .number { color: white; }
240
- .ruby .char { color: white; }
241
- .ruby .comment { color: #9933CC; }
242
- .ruby .symbol { color: white; }
243
- .ruby .regex { color: #44B4CC; }
244
- .ruby .punct { color: white; }
245
- .ruby .escape { color: white; }
246
- .ruby .interp { color: white; }
247
- .ruby .expr { color: white; }
248
-
249
- .ruby .offending { background-color: gray; }
250
- .ruby .linenum {
251
- width: 75px;
252
- padding: 0.1em 1em 0.2em 0;
253
- color: #000000;
254
- background-color: #FFFBD3;
255
- }
256
-
257
- </style>
258
- </head>
259
- <body>
260
- <div class="rspec-report">
261
-
262
- <div id="rspec-header">
263
- <div id="label">
264
- <h1>RSpec Code Examples</h1>
265
- </div>
266
-
267
- <div id="display-filters">
268
- <input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
269
- <input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
270
- <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
271
- </div>
272
-
273
- <div id="summary">
274
- <p id="totals"> </p>
275
- <p id="duration"> </p>
276
- </div>
277
- </div>
278
-
279
-
280
- <div class="results">
281
- <div id="div_group_1" class="example_group passed">
282
- <dl style="margin-left: 0px;">
283
- <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
284
- <script type="text/javascript">makeYellow('rspec-header');</script>
285
- <script type="text/javascript">makeYellow('div_group_1');</script>
286
- <script type="text/javascript">makeYellow('example_group_1');</script>
287
- <script type="text/javascript">moveProgressBar('14.2');</script>
288
- <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
289
- </dl>
290
- </div>
291
- <div id="div_group_2" class="example_group passed">
292
- <dl style="margin-left: 0px;">
293
- <dt id="example_group_2" class="passed">pending command with block format</dt>
294
- </dl>
295
- </div>
296
- <div id="div_group_3" class="example_group passed">
297
- <dl style="margin-left: 15px;">
298
- <dt id="example_group_3" class="passed">with content that would fail</dt>
299
- <script type="text/javascript">makeYellow('rspec-header');</script>
300
- <script type="text/javascript">makeYellow('div_group_3');</script>
301
- <script type="text/javascript">makeYellow('example_group_3');</script>
302
- <script type="text/javascript">moveProgressBar('28.5');</script>
303
- <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
304
- </dl>
305
- </div>
306
- <div id="div_group_4" class="example_group passed">
307
- <dl style="margin-left: 15px;">
308
- <dt id="example_group_4" class="passed">with content that would pass</dt>
309
- <script type="text/javascript">makeRed('rspec-header');</script>
310
- <script type="text/javascript">makeRed('div_group_4');</script>
311
- <script type="text/javascript">makeRed('example_group_4');</script>
312
- <script type="text/javascript">moveProgressBar('42.8');</script>
313
- <dd class="example pending_fixed">
314
- <span class="failed_spec_name">fails</span>
315
- <span class="duration">n.nnnns</span>
316
- <div class="failure" id="failure_1">
317
- <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
318
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18</pre></div>
319
- <pre class="ruby"><code><span class="linenum">16</span> <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
320
- <span class="linenum">17</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
321
- <span class="offending"><span class="linenum">18</span> <span class="ident">pending</span> <span class="keyword">do</span></span>
322
- <span class="linenum">19</span> <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
323
- <span class="linenum">20</span> <span class="keyword">end</span></code></pre>
324
- </div>
325
- </dd>
326
- </dl>
327
- </div>
328
- <div id="div_group_5" class="example_group passed">
329
- <dl style="margin-left: 0px;">
330
- <dt id="example_group_5" class="passed">passing spec</dt>
331
- <script type="text/javascript">moveProgressBar('57.1');</script>
332
- <dd class="example passed">
333
- <span class="passed_spec_name">passes</span><span class="duration">n.nnnns</span>
334
- </dd>
335
- </dl>
336
- </div>
337
- <div id="div_group_6" class="example_group passed">
338
- <dl style="margin-left: 0px;">
339
- <dt id="example_group_6" class="passed">failing spec</dt>
340
- <script type="text/javascript">makeRed('div_group_6');</script>
341
- <script type="text/javascript">makeRed('example_group_6');</script>
342
- <script type="text/javascript">moveProgressBar('71.4');</script>
343
- <dd class="example failed">
344
- <span class="failed_spec_name">fails</span>
345
- <span class="duration">n.nnnns</span>
346
- <div class="failure" id="failure_2">
347
- <div class="message"><pre>
348
- expected: 2
349
- got: 1
350
-
351
- (compared using ==)
352
- </pre></div>
353
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33</pre></div>
354
- <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
355
- <span class="linenum">32</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
356
- <span class="offending"><span class="linenum">33</span> <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
357
- <span class="linenum">34</span> <span class="keyword">end</span>
358
- <span class="linenum">35</span><span class="keyword">end</span></code></pre>
359
- </div>
360
- </dd>
361
- </dl>
362
- </div>
363
- <div id="div_group_7" class="example_group passed">
364
- <dl style="margin-left: 0px;">
365
- <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
366
- <script type="text/javascript">makeRed('div_group_7');</script>
367
- <script type="text/javascript">makeRed('example_group_7');</script>
368
- <script type="text/javascript">moveProgressBar('85.7');</script>
369
- <dd class="example failed">
370
- <span class="failed_spec_name">fails with a backtrace that has no file</span>
371
- <span class="duration">n.nnnns</span>
372
- <div class="failure" id="failure_3">
373
- <div class="message"><pre>foo</pre></div>
374
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:41</pre></div>
375
- <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
376
- </div>
377
- </dd>
378
- <script type="text/javascript">moveProgressBar('100.0');</script>
379
- <dd class="example failed">
380
- <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
381
- <span class="duration">n.nnnns</span>
382
- <div class="failure" id="failure_4">
383
- <div class="message"><pre>Exception</pre></div>
384
- <div class="backtrace"><pre></pre></div>
385
- <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
386
- </div>
387
- </dd>
388
- </dl>
389
- </div>
390
-
391
- 2 deprecation warnings total
392
- <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
393
- <script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
394
- </div>
395
- </div>
396
- </body>
397
- </html>
@@ -1,131 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
- require 'rspec/core/formatters/html_formatter'
4
- require 'nokogiri'
5
-
6
- module RSpec
7
- module Core
8
- module Formatters
9
- describe HtmlFormatter do
10
-
11
- let(:root) { File.expand_path("#{File.dirname(__FILE__)}/../../../..") }
12
- let(:expected_file) do
13
- "#{File.dirname(__FILE__)}/html_formatted.html"
14
- end
15
-
16
- let(:generated_html) do
17
- options = RSpec::Core::ConfigurationOptions.new(
18
- %w[spec/rspec/core/resources/formatter_specs.rb --format html --order defined]
19
- )
20
- options.parse_options
21
-
22
- err, out = StringIO.new, StringIO.new
23
- err.set_encoding("utf-8") if err.respond_to?(:set_encoding)
24
- out.set_encoding("utf-8") if out.respond_to?(:set_encoding)
25
-
26
- runner = RSpec::Core::Runner.new(options)
27
- configuration = runner.instance_variable_get(:@configuration)
28
-
29
- configuration.backtrace_formatter.inclusion_patterns = []
30
- configuration.output_stream = out
31
- configuration.deprecation_stream = err
32
-
33
- runner.run(err, out)
34
-
35
- html = out.string.gsub(/\d+\.\d+(s| seconds)/, "n.nnnn\\1")
36
-
37
- actual_doc = Nokogiri::HTML(html)
38
- actual_doc.css("div.backtrace pre").each do |elem|
39
- # This is to minimize churn on backtrace lines that we do not
40
- # assert on anyway.
41
- backtrace = elem.inner_html.lines.
42
- select {|e| e =~ /formatter_specs\.rb/ }.
43
- map {|x| x.chomp.split(":")[0..1].join(':') }.
44
- join("\n")
45
-
46
- elem.inner_html = backtrace
47
- end
48
- actual_doc.inner_html
49
- end
50
-
51
- let(:expected_html) do
52
- unless File.file?(expected_file)
53
- raise "There is no HTML file with expected content for this platform: #{expected_file}"
54
- end
55
- File.read(expected_file)
56
- end
57
-
58
- before do
59
- RSpec.configuration.stub(:load_spec_files) do
60
- RSpec.configuration.files_to_run.map {|f| load File.expand_path(f) }
61
- end
62
- end
63
-
64
- # Uncomment this group temporarily in order to overwrite the expected
65
- # with actual. Use with care!!!
66
- describe "file generator", :if => ENV['GENERATE'] do
67
- it "generates a new comparison file" do
68
- Dir.chdir(root) do
69
- File.open(expected_file, 'w') {|io| io.write(generated_html)}
70
- end
71
- end
72
- end
73
-
74
- def extract_backtrace_from(doc)
75
- doc.search("div.backtrace").
76
- collect {|e| e.at("pre").inner_html}.
77
- collect {|e| e.split("\n")}.flatten.
78
- select {|e| e =~ /formatter_specs\.rb/}
79
- end
80
-
81
- describe 'produced HTML', :if => RUBY_VERSION <= '2.0.0' do
82
- # Rubies before 2 are a wild west of different outputs, and it's not
83
- # worth the effort to maintain accurate fixtures for all of them.
84
- # Since we are verifying fixtures on other rubies, if this code at
85
- # least runs we can be reasonably confident the output is right since
86
- # behaviour variances that we care about across versions is neglible.
87
- it 'is present' do
88
- expect(generated_html).to be
89
- end
90
- end
91
-
92
- describe 'produced HTML', :slow, :if => RUBY_VERSION >= '2.0.0' do
93
- def build_and_verify_formatter_output
94
- Dir.chdir(root) do
95
- actual_doc = Nokogiri::HTML(generated_html)
96
- actual_backtraces = extract_backtrace_from(actual_doc)
97
- actual_doc.css("div.backtrace").remove
98
-
99
- expected_doc = Nokogiri::HTML(expected_html)
100
- expected_backtraces = extract_backtrace_from(expected_doc)
101
- expected_doc.search("div.backtrace").remove
102
-
103
- expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
104
-
105
- expected_backtraces.each_with_index do |expected_line, i|
106
- expected_path, expected_line_number, expected_suffix = expected_line.split(':')
107
- actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
108
-
109
- expect(File.expand_path(actual_path)).to eq(File.expand_path(expected_path))
110
- expect(actual_line_number).to eq(expected_line_number)
111
- expect(actual_suffix).to eq(expected_suffix)
112
- end
113
- end
114
- end
115
-
116
- it "is identical to the one we designed manually" do
117
- build_and_verify_formatter_output
118
- end
119
-
120
- context 'with mathn loaded' do
121
- include MathnIntegrationSupport
122
-
123
- it "is identical to the one we designed manually", :slow do
124
- with_mathn_loaded { build_and_verify_formatter_output }
125
- end
126
- end
127
- end
128
- end
129
- end
130
- end
131
- end
@@ -1,115 +0,0 @@
1
- require 'spec_helper'
2
- require 'rspec/core/formatters/json_formatter'
3
- require 'json'
4
- require 'rspec/core/reporter'
5
-
6
- # todo, someday:
7
- # it "lists the groups (describe and context) separately"
8
- # it "includes full 'execution_result'"
9
- # it "relativizes backtrace paths"
10
- # it "includes profile information (implements dump_profile)"
11
- # it "shows the pending message if one was given"
12
- # it "shows the seed if run was randomized"
13
- # it "lists pending specs that were fixed"
14
- describe RSpec::Core::Formatters::JsonFormatter do
15
- let(:output) { StringIO.new }
16
- let(:formatter) { RSpec::Core::Formatters::JsonFormatter.new(output) }
17
- let(:reporter) { RSpec::Core::Reporter.new(formatter) }
18
-
19
- it "outputs json (brittle high level functional test)" do
20
- group = RSpec::Core::ExampleGroup.describe("one apiece") do
21
- it("succeeds") { expect(1).to eq 1 }
22
- it("fails") { fail "eek" }
23
- it("pends") { pending "world peace" }
24
- end
25
- succeeding_line = __LINE__ - 4
26
- failing_line = __LINE__ - 4
27
- pending_line = __LINE__ - 4
28
-
29
- now = Time.now
30
- Time.stub(:now).and_return(now)
31
- reporter.report(2) do |r|
32
- group.run(r)
33
- end
34
-
35
- # grab the actual backtrace -- kind of a cheat
36
- failing_backtrace = formatter.output_hash[:examples][1][:exception][:backtrace]
37
- this_file = relative_path(__FILE__)
38
-
39
- expected = {
40
- :examples => [
41
- {
42
- :description => "succeeds",
43
- :full_description => "one apiece succeeds",
44
- :status => "passed",
45
- :file_path => this_file,
46
- :line_number => succeeding_line,
47
- },
48
- {
49
- :description => "fails",
50
- :full_description => "one apiece fails",
51
- :status => "failed",
52
- :file_path => this_file,
53
- :line_number => failing_line,
54
- :exception => {:class => "RuntimeError", :message => "eek", :backtrace => failing_backtrace}
55
- },
56
- {
57
- :description => "pends",
58
- :full_description => "one apiece pends",
59
- :status => "pending",
60
- :file_path => this_file,
61
- :line_number => pending_line,
62
- },
63
- ],
64
- :summary => {
65
- :duration => formatter.output_hash[:summary][:duration],
66
- :example_count => 3,
67
- :failure_count => 1,
68
- :pending_count => 1,
69
- },
70
- :summary_line => "3 examples, 1 failure, 1 pending"
71
- }
72
- expect(formatter.output_hash).to eq expected
73
- expect(output.string).to eq expected.to_json
74
- end
75
-
76
- describe "#stop" do
77
- it "adds all examples to the output hash" do
78
- formatter.stop
79
- expect(formatter.output_hash[:examples]).not_to be_nil
80
- end
81
- end
82
-
83
- describe "#close" do
84
- it "outputs the results as a JSON string" do
85
- expect(output.string).to eq ""
86
- formatter.close
87
- expect(output.string).to eq({}.to_json)
88
- end
89
- end
90
-
91
- describe "#message" do
92
- it "adds a message to the messages list" do
93
- formatter.message("good job")
94
- expect(formatter.output_hash[:messages]).to eq ["good job"]
95
- end
96
- end
97
-
98
- describe "#dump_summary" do
99
- it "adds summary info to the output hash" do
100
- duration, example_count, failure_count, pending_count = 1.0, 2, 1, 1
101
- formatter.dump_summary(duration, example_count, failure_count, pending_count)
102
- summary = formatter.output_hash[:summary]
103
- %w(duration example_count failure_count pending_count).each do |key|
104
- expect(summary[key.to_sym]).to eq eval(key)
105
- end
106
- summary_line = formatter.output_hash[:summary_line]
107
- expect(summary_line).to eq "2 examples, 1 failure, 1 pending"
108
- end
109
-
110
- it "ignores --profile" do
111
- allow(RSpec.configuration).to receive(:profile_examples).and_return(true)
112
- formatter.dump_summary(1.0, 2, 1, 1)
113
- end
114
- end
115
- 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
- expect(@output.string).to 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
- expect(@output.string).to match(/2 examples, 0 failures/i)
22
- expect(@output.string).not_to match(/0 pending/i)
23
- end
24
-
25
- it "pushes nothing on start" do
26
- @formatter.start(4)
27
- expect(@output.string).to eq("")
28
- end
29
-
30
- end