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,26 +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
- expect(RSpec::Core::Formatters::SnippetExtractor.new.snippet_for("blech")).to 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
- expect(RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8)).to eq("# Couldn't get snippet for blech")
14
- end
15
-
16
- it "falls back on a default message when it gets a security error" do
17
- message = nil
18
- safely do
19
- message = RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8)
20
- end
21
- expect(message).to eq("# Couldn't get snippet for blech")
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -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>&lt;a href="txmt://open?url=file</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>&lt;a href="txmt://open?url=file</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>&lt;a href="txmt://open?url=file</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,107 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
- require 'rspec/core/formatters/text_mate_formatter'
4
- require 'nokogiri'
5
-
6
- module RSpec
7
- module Core
8
- module Formatters
9
- describe TextMateFormatter do
10
-
11
- let(:root) { File.expand_path("#{File.dirname(__FILE__)}/../../../..") }
12
- let(:expected_file) do
13
- "#{File.dirname(__FILE__)}/text_mate_formatted.html"
14
- end
15
-
16
- let(:generated_html) do
17
- allow(RSpec).to receive(:deprecate)
18
- options = RSpec::Core::ConfigurationOptions.new(
19
- %w[spec/rspec/core/resources/formatter_specs.rb --format textmate --order defined]
20
- )
21
- options.parse_options
22
-
23
- err, out = StringIO.new, StringIO.new
24
- err.set_encoding("utf-8") if err.respond_to?(:set_encoding)
25
- out.set_encoding("utf-8") if out.respond_to?(:set_encoding)
26
-
27
- runner = RSpec::Core::Runner.new(options)
28
- configuration = runner.instance_variable_get(:@configuration)
29
-
30
- configuration.backtrace_formatter.inclusion_patterns = []
31
- configuration.output_stream = out
32
- configuration.deprecation_stream = err
33
-
34
- runner.run(err, out)
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
- describe 'produced HTML', :if => RUBY_VERSION <= '2.0.0' do
75
- # Rubies before 2 are a wild west of different outputs, and it's not
76
- # worth the effort to maintain accurate fixtures for all of them.
77
- # Since we are verifying fixtures on other rubies, if this code at
78
- # least runs we can be reasonably confident the output is right since
79
- # behaviour variances that we care about across versions is neglible.
80
- it 'is present' do
81
- expect(generated_html).to be
82
- end
83
- end
84
-
85
- context 'produced HTML', :if => RUBY_VERSION >= '2.0.0' do
86
- it "produces HTML identical to the one we designed manually" do
87
- Dir.chdir(root) do
88
- actual_doc = Nokogiri::HTML(generated_html)
89
- backtrace_lines = actual_doc.search("div.backtrace a")
90
- actual_doc.search("div.backtrace").remove
91
-
92
- expected_doc = Nokogiri::HTML(expected_html)
93
- expected_doc.search("div.backtrace").remove
94
-
95
- expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
96
-
97
- backtrace_lines.each do |backtrace_line|
98
- expect(backtrace_line['href']).to include("txmt://open?url=")
99
- end
100
- end
101
- end
102
- end
103
-
104
- end
105
- end
106
- end
107
- end