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,343 +0,0 @@
1
- Feature: around hooks
2
-
3
- Around hooks receive the example as a block argument, extended to behave like
4
- a proc. This lets you define code that should be executed before and after
5
- the example. Of course, you can do the same thing with before and after hooks,
6
- and it's often cleaner to do so.
7
-
8
- Where around hooks shine is when you want to run an example in a block. For
9
- example, if your database library offers a transaction method that receives
10
- a block, you can use an around hook as described in the first scenario:
11
-
12
- WARNING: around hooks do not share state with the example the way before and
13
- after hooks do. This means that you can not share instance variables between
14
- around hooks and examples.
15
-
16
- Also, mock frameworks are set up and torn down within the context of running
17
- the example, so you can not interact with them directly in around hooks.
18
-
19
- Scenario: use the example as a proc within the block passed to around()
20
- Given a file named "example_spec.rb" with:
21
- """ruby
22
- class Database
23
- def self.transaction
24
- puts "open transaction"
25
- yield
26
- puts "close transaction"
27
- end
28
- end
29
-
30
- describe "around filter" do
31
- around(:each) do |example|
32
- Database.transaction(&example)
33
- end
34
-
35
- it "gets run in order" do
36
- puts "run the example"
37
- end
38
- end
39
- """
40
- When I run `rspec example_spec.rb`
41
- Then the output should contain:
42
- """
43
- open transaction
44
- run the example
45
- close transaction
46
- """
47
-
48
- Scenario: invoke the example using run()
49
- Given a file named "example_spec.rb" with:
50
- """ruby
51
- describe "around hook" do
52
- around(:each) do |example|
53
- puts "around each before"
54
- example.run
55
- puts "around each after"
56
- end
57
-
58
- it "gets run in order" do
59
- puts "in the example"
60
- end
61
- end
62
- """
63
- When I run `rspec example_spec.rb`
64
- Then the output should contain:
65
- """
66
- around each before
67
- in the example
68
- around each after
69
- """
70
-
71
- Scenario: access the example metadata
72
- Given a file named "example_spec.rb" with:
73
- """ruby
74
- describe "something" do
75
- around(:each) do |example|
76
- puts example.metadata[:foo]
77
- example.run
78
- end
79
-
80
- it "does something", :foo => "this should show up in the output" do
81
- end
82
- end
83
- """
84
- When I run `rspec example_spec.rb`
85
- Then the output should contain "this should show up in the output"
86
-
87
- Scenario: define a global around hook
88
- Given a file named "example_spec.rb" with:
89
- """ruby
90
- RSpec.configure do |c|
91
- c.around(:each) do |example|
92
- puts "around each before"
93
- example.run
94
- puts "around each after"
95
- end
96
- end
97
-
98
- describe "around filter" do
99
- it "gets run in order" do
100
- puts "in the example"
101
- end
102
- end
103
- """
104
- When I run `rspec example_spec.rb`
105
- Then the output should contain:
106
- """
107
- around each before
108
- in the example
109
- around each after
110
- """
111
-
112
- Scenario: before/after(:each) hooks are wrapped by the around hook
113
- Given a file named "example_spec.rb" with:
114
- """ruby
115
- describe "around filter" do
116
- around(:each) do |example|
117
- puts "around each before"
118
- example.run
119
- puts "around each after"
120
- end
121
-
122
- before(:each) do
123
- puts "before each"
124
- end
125
-
126
- after(:each) do
127
- puts "after each"
128
- end
129
-
130
- it "gets run in order" do
131
- puts "in the example"
132
- end
133
- end
134
- """
135
- When I run `rspec example_spec.rb`
136
- Then the output should contain:
137
- """
138
- around each before
139
- before each
140
- in the example
141
- after each
142
- around each after
143
- """
144
-
145
- Scenario: before/after(:all) hooks are NOT wrapped by the around hook
146
- Given a file named "example_spec.rb" with:
147
- """ruby
148
- describe "around filter" do
149
- around(:each) do |example|
150
- puts "around each before"
151
- example.run
152
- puts "around each after"
153
- end
154
-
155
- before(:all) do
156
- puts "before all"
157
- end
158
-
159
- after(:all) do
160
- puts "after all"
161
- end
162
-
163
- it "gets run in order" do
164
- puts "in the example"
165
- end
166
- end
167
- """
168
- When I run `rspec --format progress example_spec.rb`
169
- Then the output should contain:
170
- """
171
- before all
172
- around each before
173
- in the example
174
- around each after
175
- .after all
176
- """
177
-
178
- Scenario: examples run by an around block are run in the configured context
179
- Given a file named "example_spec.rb" with:
180
- """ruby
181
- module IncludedInConfigureBlock
182
- def included_in_configure_block; true; end
183
- end
184
-
185
- RSpec.configure do |c|
186
- c.include IncludedInConfigureBlock
187
- end
188
-
189
- describe "around filter" do
190
- around(:each) do |example|
191
- example.run
192
- end
193
-
194
- it "runs the example in the correct context" do
195
- included_in_configure_block.should be_truthy
196
- end
197
- end
198
- """
199
- When I run `rspec example_spec.rb`
200
- Then the output should contain "1 example, 0 failure"
201
-
202
- Scenario: implicitly pending examples are detected as Not yet implemented
203
- Given a file named "example_spec.rb" with:
204
- """ruby
205
- describe "implicit pending example" do
206
- around(:each) do |example|
207
- example.run
208
- end
209
-
210
- it "should be detected as Not yet implemented"
211
- end
212
- """
213
- When I run `rspec example_spec.rb`
214
- Then the output should contain "1 example, 0 failures, 1 pending"
215
- And the output should contain:
216
- """
217
- Pending:
218
- implicit pending example should be detected as Not yet implemented
219
- # Not yet implemented
220
- """
221
-
222
-
223
- Scenario: explicitly pending examples are detected as pending
224
- Given a file named "example_spec.rb" with:
225
- """ruby
226
- describe "explicit pending example" do
227
- around(:each) do |example|
228
- example.run
229
- end
230
-
231
- it "should be detected as pending" do
232
- pending
233
- end
234
- end
235
- """
236
- When I run `rspec example_spec.rb`
237
- Then the output should contain "1 example, 0 failures, 1 pending"
238
- And the output should contain:
239
- """
240
- explicit pending example should be detected as pending
241
- # No reason given
242
- """
243
-
244
- Scenario: multiple around hooks in the same scope
245
- Given a file named "example_spec.rb" with:
246
- """ruby
247
- describe "if there are multiple around hooks in the same scope" do
248
- around(:each) do |example|
249
- puts "first around hook before"
250
- example.run
251
- puts "first around hook after"
252
- end
253
-
254
- around(:each) do |example|
255
- puts "second around hook before"
256
- example.run
257
- puts "second around hook after"
258
- end
259
-
260
- it "they should all be run" do
261
- puts "in the example"
262
- 1.should eq(1)
263
- end
264
- end
265
- """
266
- When I run `rspec example_spec.rb`
267
- Then the output should contain "1 example, 0 failure"
268
- And the output should contain:
269
- """
270
- first around hook before
271
- second around hook before
272
- in the example
273
- second around hook after
274
- first around hook after
275
- """
276
-
277
- Scenario: around hooks in multiple scopes
278
- Given a file named "example_spec.rb" with:
279
- """ruby
280
- describe "if there are around hooks in an outer scope" do
281
- around(:each) do |example|
282
- puts "first outermost around hook before"
283
- example.run
284
- puts "first outermost around hook after"
285
- end
286
-
287
- around(:each) do |example|
288
- puts "second outermost around hook before"
289
- example.run
290
- puts "second outermost around hook after"
291
- end
292
-
293
- describe "outer scope" do
294
- around(:each) do |example|
295
- puts "first outer around hook before"
296
- example.run
297
- puts "first outer around hook after"
298
- end
299
-
300
- around(:each) do |example|
301
- puts "second outer around hook before"
302
- example.run
303
- puts "second outer around hook after"
304
- end
305
-
306
- describe "inner scope" do
307
- around(:each) do |example|
308
- puts "first inner around hook before"
309
- example.run
310
- puts "first inner around hook after"
311
- end
312
-
313
- around(:each) do |example|
314
- puts "second inner around hook before"
315
- example.run
316
- puts "second inner around hook after"
317
- end
318
-
319
- it "they should all be run" do
320
- puts "in the example"
321
- end
322
- end
323
- end
324
- end
325
- """
326
- When I run `rspec example_spec.rb`
327
- Then the output should contain "1 example, 0 failure"
328
- And the output should contain:
329
- """
330
- first outermost around hook before
331
- second outermost around hook before
332
- first outer around hook before
333
- second outer around hook before
334
- first inner around hook before
335
- second inner around hook before
336
- in the example
337
- second inner around hook after
338
- first inner around hook after
339
- second outer around hook after
340
- first outer around hook after
341
- second outermost around hook after
342
- first outermost around hook after
343
- """