rspec-core 2.99.2 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +2 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +103 -191
  5. data/License.txt +1 -0
  6. data/README.md +4 -25
  7. data/features/Upgrade.md +2 -14
  8. data/features/command_line/dry_run.feature +29 -0
  9. data/features/command_line/example_name_option.feature +1 -1
  10. data/features/command_line/fail_fast.feature +26 -0
  11. data/features/command_line/format_option.feature +3 -3
  12. data/features/command_line/line_number_option.feature +16 -11
  13. data/features/command_line/order.feature +2 -3
  14. data/features/command_line/pattern_option.feature +3 -3
  15. data/features/command_line/randomization.feature +63 -0
  16. data/features/command_line/require_option.feature +2 -2
  17. data/features/command_line/ruby.feature +1 -1
  18. data/features/configuration/alias_example_to.feature +13 -22
  19. data/features/configuration/{backtrace_clean_patterns.feature → backtrace_exclusion_patterns.feature} +17 -14
  20. data/features/configuration/custom_settings.feature +11 -11
  21. data/features/configuration/overriding_global_ordering.feature +93 -0
  22. data/features/configuration/profile.feature +13 -13
  23. data/features/configuration/read_options_from_file.feature +7 -7
  24. data/features/example_groups/basic_structure.feature +1 -1
  25. data/features/example_groups/shared_context.feature +8 -8
  26. data/features/example_groups/shared_examples.feature +6 -14
  27. data/features/expectation_framework_integration/configure_expectation_framework.feature +27 -122
  28. data/features/filtering/exclusion_filters.feature +2 -5
  29. data/features/filtering/inclusion_filters.feature +1 -5
  30. data/features/formatters/json_formatter.feature +2 -2
  31. data/features/formatters/text_formatter.feature +4 -4
  32. data/features/helper_methods/arbitrary_methods.feature +2 -2
  33. data/features/helper_methods/let.feature +5 -5
  34. data/features/helper_methods/modules.feature +5 -8
  35. data/features/hooks/around_hooks.feature +2 -2
  36. data/features/hooks/before_and_after_hooks.feature +14 -14
  37. data/features/hooks/filtering.feature +12 -14
  38. data/features/metadata/described_class.feature +1 -1
  39. data/features/metadata/user_defined.feature +16 -29
  40. data/features/mock_framework_integration/use_flexmock.feature +1 -1
  41. data/features/mock_framework_integration/use_mocha.feature +1 -1
  42. data/features/mock_framework_integration/use_rr.feature +1 -1
  43. data/features/mock_framework_integration/use_rspec.feature +5 -5
  44. data/features/pending/pending_examples.feature +5 -5
  45. data/features/spec_files/arbitrary_file_suffix.feature +1 -1
  46. data/features/step_definitions/additional_cli_steps.rb +3 -3
  47. data/features/subject/explicit_subject.feature +8 -8
  48. data/features/subject/implicit_receiver.feature +29 -0
  49. data/features/subject/implicit_subject.feature +4 -4
  50. data/features/support/env.rb +10 -3
  51. data/features/support/require_expect_syntax_in_aruba_specs.rb +16 -0
  52. data/lib/rspec/core.rb +11 -48
  53. data/lib/rspec/core/backport_random.rb +302 -0
  54. data/lib/rspec/core/backtrace_formatter.rb +65 -0
  55. data/lib/rspec/core/command_line.rb +7 -18
  56. data/lib/rspec/core/configuration.rb +202 -507
  57. data/lib/rspec/core/configuration_options.rb +17 -30
  58. data/lib/rspec/core/example.rb +29 -39
  59. data/lib/rspec/core/example_group.rb +166 -259
  60. data/lib/rspec/core/filter_manager.rb +30 -47
  61. data/lib/rspec/core/flat_map.rb +17 -0
  62. data/lib/rspec/core/formatters.rb +0 -138
  63. data/lib/rspec/core/formatters/base_formatter.rb +46 -1
  64. data/lib/rspec/core/formatters/base_text_formatter.rb +38 -61
  65. data/lib/rspec/core/formatters/deprecation_formatter.rb +21 -52
  66. data/lib/rspec/core/formatters/helpers.rb +0 -28
  67. data/lib/rspec/core/formatters/html_formatter.rb +1 -1
  68. data/lib/rspec/core/formatters/json_formatter.rb +38 -9
  69. data/lib/rspec/core/formatters/snippet_extractor.rb +14 -5
  70. data/lib/rspec/core/hooks.rb +55 -39
  71. data/lib/rspec/core/memoized_helpers.rb +17 -167
  72. data/lib/rspec/core/metadata.rb +16 -64
  73. data/lib/rspec/core/option_parser.rb +30 -39
  74. data/lib/rspec/core/ordering.rb +154 -0
  75. data/lib/rspec/core/pending.rb +12 -69
  76. data/lib/rspec/core/project_initializer.rb +12 -10
  77. data/lib/rspec/core/rake_task.rb +5 -108
  78. data/lib/rspec/core/reporter.rb +15 -18
  79. data/lib/rspec/core/runner.rb +16 -30
  80. data/lib/rspec/core/shared_context.rb +3 -5
  81. data/lib/rspec/core/shared_example_group.rb +3 -51
  82. data/lib/rspec/core/shared_example_group/collection.rb +1 -19
  83. data/lib/rspec/core/version.rb +1 -1
  84. data/lib/rspec/core/warnings.rb +22 -0
  85. data/lib/rspec/core/world.rb +12 -8
  86. data/spec/command_line/order_spec.rb +20 -23
  87. data/spec/rspec/core/backtrace_formatter_spec.rb +216 -0
  88. data/spec/rspec/core/command_line_spec.rb +32 -48
  89. data/spec/rspec/core/configuration_options_spec.rb +19 -50
  90. data/spec/rspec/core/configuration_spec.rb +142 -713
  91. data/spec/rspec/core/drb_command_line_spec.rb +2 -0
  92. data/spec/rspec/core/dsl_spec.rb +0 -1
  93. data/spec/rspec/core/example_group_spec.rb +192 -223
  94. data/spec/rspec/core/example_spec.rb +40 -16
  95. data/spec/rspec/core/filter_manager_spec.rb +2 -2
  96. data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -41
  97. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +5 -123
  98. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +2 -87
  99. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +2 -3
  100. data/spec/rspec/core/formatters/{text_mate_formatted.html → html_formatted-1.8.7-jruby.html} +44 -25
  101. data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +477 -0
  102. data/spec/rspec/core/formatters/{html_formatted.html → html_formatted-1.8.7.html} +42 -25
  103. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +425 -0
  104. data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +416 -0
  105. data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +477 -0
  106. data/spec/rspec/core/formatters/html_formatted-1.9.3.html +419 -0
  107. data/spec/rspec/core/formatters/html_formatted-2.0.0.html +425 -0
  108. data/spec/rspec/core/formatters/html_formatter_spec.rb +21 -46
  109. data/spec/rspec/core/formatters/json_formatter_spec.rb +97 -8
  110. data/spec/rspec/core/hooks_filtering_spec.rb +5 -5
  111. data/spec/rspec/core/hooks_spec.rb +61 -47
  112. data/spec/rspec/core/memoized_helpers_spec.rb +20 -322
  113. data/spec/rspec/core/metadata_spec.rb +1 -24
  114. data/spec/rspec/core/option_parser_spec.rb +20 -62
  115. data/spec/rspec/core/ordering_spec.rb +102 -0
  116. data/spec/rspec/core/pending_example_spec.rb +0 -40
  117. data/spec/rspec/core/project_initializer_spec.rb +1 -25
  118. data/spec/rspec/core/rake_task_spec.rb +5 -72
  119. data/spec/rspec/core/random_spec.rb +47 -0
  120. data/spec/rspec/core/reporter_spec.rb +23 -48
  121. data/spec/rspec/core/runner_spec.rb +31 -39
  122. data/spec/rspec/core/shared_context_spec.rb +3 -15
  123. data/spec/rspec/core/shared_example_group/collection_spec.rb +4 -17
  124. data/spec/rspec/core/shared_example_group_spec.rb +12 -45
  125. data/spec/rspec/core/{deprecation_spec.rb → warnings_spec.rb} +3 -1
  126. data/spec/rspec/core_spec.rb +4 -21
  127. data/spec/spec_helper.rb +41 -5
  128. data/spec/support/helper_methods.rb +0 -29
  129. data/spec/support/sandboxed_mock_space.rb +0 -16
  130. data/spec/support/shared_example_groups.rb +7 -36
  131. data/spec/support/stderr_splitter.rb +36 -0
  132. metadata +163 -157
  133. metadata.gz.sig +1 -0
  134. data/exe/autospec +0 -13
  135. data/features/Autotest.md +0 -38
  136. data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +0 -52
  137. data/features/subject/attribute_of_subject.feature +0 -124
  138. data/features/subject/one_liner_syntax.feature +0 -71
  139. data/lib/autotest/discover.rb +0 -10
  140. data/lib/autotest/rspec2.rb +0 -77
  141. data/lib/rspec/core/backtrace_cleaner.rb +0 -46
  142. data/lib/rspec/core/backward_compatibility.rb +0 -55
  143. data/lib/rspec/core/caller_filter.rb +0 -60
  144. data/lib/rspec/core/deprecated_mutable_array_proxy.rb +0 -32
  145. data/lib/rspec/core/deprecation.rb +0 -26
  146. data/lib/rspec/core/extensions/instance_eval_with_args.rb +0 -44
  147. data/lib/rspec/core/extensions/kernel.rb +0 -9
  148. data/lib/rspec/core/extensions/module_eval_with_args.rb +0 -38
  149. data/lib/rspec/core/extensions/ordered.rb +0 -27
  150. data/lib/rspec/core/formatters/console_codes.rb +0 -42
  151. data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -34
  152. data/lib/rspec/core/metadata_hash_builder.rb +0 -97
  153. data/lib/rspec/core/minitest_assertions_adapter.rb +0 -28
  154. data/lib/rspec/core/test_unit_assertions_adapter.rb +0 -30
  155. data/spec/autotest/discover_spec.rb +0 -49
  156. data/spec/autotest/failed_results_re_spec.rb +0 -45
  157. data/spec/autotest/rspec_spec.rb +0 -133
  158. data/spec/rspec/core/backtrace_cleaner_spec.rb +0 -68
  159. data/spec/rspec/core/caller_filter_spec.rb +0 -58
  160. data/spec/rspec/core/deprecations_spec.rb +0 -59
  161. data/spec/rspec/core/formatters/console_codes_spec.rb +0 -50
  162. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -107
  163. data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
  164. data/spec/rspec/core/pending_spec.rb +0 -27
  165. data/spec/support/silence_dsl_deprecations.rb +0 -32
@@ -1,5 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
+ Copyright (c) 2012 Chad Humphries, David Chelimsky, Myron Marston
3
4
  Copyright (c) 2009 Chad Humphries, David Chelimsky
4
5
  Copyright (c) 2006 David Chelimsky, The RSpec Development Team
5
6
  Copyright (c) 2005 Steven Baker
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rspec-core [![Build Status](https://secure.travis-ci.org/rspec/rspec-core.png?branch=master)](http://travis-ci.org/rspec/rspec-core) [![Code Climate](https://codeclimate.com/github/rspec/rspec-core.png)](https://codeclimate.com/github/rspec/rspec-core)
1
+ # rspec-core [![Build Status](https://secure.travis-ci.org/rspec/rspec-core.png?branch=master)](http://travis-ci.org/rspec/rspec-core) [![Code Climate](https://codeclimate.com/github/rspec/rspec-core.png)](https://codeclimate.com/github/rspec/rspec-core) [![Coverage Status](https://coveralls.io/repos/rspec/rspec-core/badge.png?branch=master)](https://coveralls.io/r/rspec/rspec-core?branch=master)
2
2
 
3
3
  rspec-core provides the structure for writing executable examples of how your
4
4
  code should behave, and an `rspec` command with tools to constrain which
@@ -165,30 +165,9 @@ the command line.
165
165
 
166
166
  ## autotest integration
167
167
 
168
- rspec-core ships with an Autotest extension, which is loaded automatically if
169
- there is a `.rspec` file in the project's root directory.
170
-
171
- ## rcov integration
172
-
173
- rcov is best integrated via the [rcov rake
174
- task](http://www.rubydoc.info/github/relevance/rcov/master/Rcov/RcovTask).
175
-
176
- rcov can also be integrated via the rspec rake task, but it requires a bit
177
- more setup:
178
-
179
- ```ruby
180
- # Rakefile
181
- require 'rspec/core/rake_task'
182
-
183
- RSpec::Core::RakeTask.new(:spec) do |config|
184
- config.rcov = true
185
- end
186
-
187
- task :default => :spec
188
-
189
- # spec/spec_helper.rb
190
- require 'rspec/autorun' # **add this**
191
- ```
168
+ rspec-core no longer ships with an Autotest extension, if you require Autotest
169
+ integration, please use the `rspec-autotest` gem and see [rspec/auto-test](https://github.com/rspec/auto-test)
170
+ for details
192
171
 
193
172
  ## get started
194
173
 
@@ -123,10 +123,10 @@ Use :if and :unless keys to conditionally run examples with simple boolean
123
123
  expressions:
124
124
 
125
125
  describe "something" do
126
- it "does something", :if => RUBY_VERSION == 1.8.6 do
126
+ it "does something", :if => RUBY_VERSION == 1.8.7 do
127
127
  # ...
128
128
  end
129
- it "does something", :unless => RUBY_VERSION == 1.8.6 do
129
+ it "does something", :unless => RUBY_VERSION == 1.8.7 do
130
130
  # ...
131
131
  end
132
132
  end
@@ -285,14 +285,6 @@ A few things changed in the Rake task used to run specs:
285
285
  so the options must be embedded directly in the Rakefile, or stored in the
286
286
  `.rspec` files mentioned above.
287
287
 
288
- 3. In RSpec-1, the rake task would read in rcov options from an `rcov.opts`
289
- file. This is ignored by RSpec-2. RCov options are now set directly on the Rake
290
- task:
291
-
292
- RSpec::Core::RakeTask.new(:rcov) do |t|
293
- t.rcov_opts = %q[--exclude "spec"]
294
- end
295
-
296
288
  3. The `spec_files` accessor has been replaced by `pattern`.
297
289
 
298
290
  # rspec-1
@@ -311,10 +303,6 @@ A few things changed in the Rake task used to run specs:
311
303
  t.pattern = 'spec/**/*_spec.rb'
312
304
  end
313
305
 
314
- ### autotest
315
-
316
- `autospec` is dead. Long live `autotest`.
317
-
318
306
  ### RSpec is the new Spec
319
307
 
320
308
  The root namespace (top level module) is now `RSpec` instead of `Spec`, and
@@ -0,0 +1,29 @@
1
+ Feature: --dry-run
2
+
3
+ Use the `--dry-run` option to have RSpec print your suite's formatter
4
+ output without running any examples or hooks.
5
+
6
+ Scenario: Using --dry-run
7
+ Given a file named "spec/dry_run_spec.rb" with:
8
+ """ruby
9
+ RSpec.configure do |c|
10
+ c.before(:suite) { puts "before suite" }
11
+ c.after(:suite) { puts "after suite" }
12
+ end
13
+
14
+ describe "dry run" do
15
+ before(:all) { fail }
16
+ before(:each) { fail }
17
+
18
+ it "fails in example" do
19
+ fail
20
+ end
21
+
22
+ after(:each) { fail }
23
+ after(:all) { fail }
24
+ end
25
+ """
26
+ When I run `rspec --dry-run`
27
+ Then the output should contain "1 example, 0 failures"
28
+ And the output should not contain "before suite"
29
+ And the output should not contain "after suite"
@@ -41,7 +41,7 @@ Feature: --example option
41
41
  describe Array do
42
42
  describe "#length" do
43
43
  it "is the number of items" do
44
- Array.new([1,2,3]).length.should eq 3
44
+ expect(Array.new([1,2,3]).length).to eq 3
45
45
  end
46
46
  end
47
47
  end
@@ -0,0 +1,26 @@
1
+ Feature: --fail-fast
2
+
3
+ Use the `--fail-fast` option to tell RSpec to stop running the test suite on the first failed test.
4
+
5
+ You may also specify `--no-fail-fast` to turn it off (default behaviour).
6
+
7
+ Background:
8
+ Given a file named "fail_fast_spec.rb" with:
9
+ """ruby
10
+ describe "fail fast" do
11
+ it "passing test" do; end
12
+ it "failing test" do
13
+ fail
14
+ end
15
+ it "this should not be run" do; end
16
+ end
17
+ """
18
+
19
+ Scenario: Using --fail-fast
20
+ When I run `rspec . --fail-fast`
21
+ Then the output should contain ".F"
22
+ Then the output should not contain ".F."
23
+
24
+ Scenario: Using --no-fail-fast
25
+ When I run `rspec . --no-fail-fast`
26
+ Then the output should contain ".F."
@@ -26,15 +26,15 @@ Feature: --format option
26
26
  """ruby
27
27
  describe "something" do
28
28
  it "does something that passes" do
29
- 5.should eq(5)
29
+ expect(5).to eq(5)
30
30
  end
31
31
 
32
32
  it "does something that fails" do
33
- 5.should eq(4)
33
+ expect(5).to eq(4)
34
34
  end
35
35
 
36
36
  it "does something that is pending", :pending => true do
37
- 5.should be > 3
37
+ expect(5).to be > 3
38
38
  end
39
39
  end
40
40
  """
@@ -14,26 +14,30 @@ Feature: --line_number option
14
14
  describe 9 do
15
15
 
16
16
  it "should be > 8" do
17
- 9.should be > 8
17
+ expect(9).to be > 8
18
18
  end
19
19
 
20
20
  it "should be < 10" do
21
- 9.should be < 10
21
+ expect(9).to be < 10
22
22
  end
23
23
 
24
24
  it "should be 3 squared" do
25
- 9.should be 3*3
25
+ expect(9).to be 3*3
26
26
  end
27
27
 
28
28
  end
29
29
  """
30
- When I run `rspec example_spec.rb --line_number 5`
30
+ When I run `rspec example_spec.rb --line_number 5 --format doc`
31
31
  Then the examples should all pass
32
- And the output should contain "1 example"
32
+ And the output should contain "should be > 8"
33
+ But the output should not contain "should be < 10"
34
+ And the output should not contain "should be 3*3"
33
35
 
34
- When I run `rspec example_spec.rb --line_number 5 --line_number 9`
36
+ When I run `rspec example_spec.rb --line_number 5 --line_number 9 --format doc`
35
37
  Then the examples should all pass
36
- And the output should contain "2 examples"
38
+ And the output should contain "should be > 8"
39
+ And the output should contain "should be < 10"
40
+ But the output should not contain "should be 3*3"
37
41
 
38
42
  Scenario: one liner
39
43
  Given a file named "example_spec.rb" with:
@@ -42,12 +46,13 @@ Feature: --line_number option
42
46
 
43
47
  describe 9 do
44
48
 
45
- it { is_expected.to be > 8 }
49
+ it { should be > 8 }
46
50
 
47
- it { is_expected.not_to be < 10 }
51
+ it { should be < 10 }
48
52
 
49
53
  end
50
54
  """
51
- When I run `rspec example_spec.rb --line_number 5`
55
+ When I run `rspec example_spec.rb --line_number 5 --format doc`
52
56
  Then the examples should all pass
53
- And the output should contain "1 example"
57
+ Then the output should contain "should be > 8"
58
+ But the output should not contain "should be < 10"
@@ -6,14 +6,13 @@ Feature: --order (new in rspec-core-2.8)
6
6
  `defined` is the default, which executes groups and examples in the
7
7
  order they are defined as the spec files are loaded.
8
8
 
9
- Use `rand` to randomize the order of files, groups within files, and
10
- examples within groups.*
9
+ Use `rand` to randomize the order of groups and examples within groups.*
11
10
 
12
11
  * Nested groups are always run from top-level to bottom-level in order to avoid
13
12
  executing `before(:all)` and `after(:all)` hooks more than once, but the order
14
13
  of groups at each level is randomized.
15
14
 
16
- You can also specify a seed
15
+ You can also specify a seed:
17
16
 
18
17
  <h3>Examples</h3>
19
18
 
@@ -11,7 +11,7 @@ Feature: pattern option
11
11
  """ruby
12
12
  describe "addition" do
13
13
  it "adds things" do
14
- (1 + 2).should eq(3)
14
+ expect(1 + 2).to eq(3)
15
15
  end
16
16
  end
17
17
  """
@@ -23,7 +23,7 @@ Feature: pattern option
23
23
  """ruby
24
24
  describe "addition" do
25
25
  it "adds things" do
26
- (1 + 2).should eq(3)
26
+ expect(1 + 2).to eq(3)
27
27
  end
28
28
  end
29
29
  """
@@ -41,7 +41,7 @@ Feature: pattern option
41
41
  """ruby
42
42
  describe "addition" do
43
43
  it "adds things" do
44
- (1 + 2).should eq(3)
44
+ expect(1 + 2).to eq(3)
45
45
  end
46
46
  end
47
47
  """
@@ -0,0 +1,63 @@
1
+ Feature: Randomization can be reproduced across test runs
2
+
3
+ In Ruby, randomness is seeded by calling `srand`
4
+ and passing it the seed that you want to use.
5
+ By doing this, subsequent calls to `rand`, `shuffle`, `sample`, etc.
6
+ will all be randomized the same way given the same seed is passed to `srand`.
7
+
8
+ RSpec takes care not to seed randomization directly
9
+ when taking action that involves randomness
10
+ (such as random ordering of examples).
11
+
12
+ Since RSpec does not ever invoke `srand`, this means that you
13
+ are free to choose which, if any, mechanism is used to seed randomization.
14
+
15
+ There is an example below of how to use RSpec's seed for this purpose
16
+ if you wish to do so.
17
+
18
+ If you would like to manage seeding randomization without any help from RSpec,
19
+ please keep the following things in mind:
20
+
21
+ * The seed should never be hard-coded.
22
+
23
+ The first example below only does this to show that seeding randomization
24
+ with a seed other than the one used by RSpec
25
+ will correctly seed randomization.
26
+
27
+ * Report the seed that was chosen.
28
+
29
+ The randomization that was used for a given test run can not be reproduced
30
+ if noone knows what seed was used to begin with.
31
+
32
+ * Provide a mechanism to feed the seed into the tests.
33
+
34
+ Without this, the call to `srand` will have to be hard-coded any time
35
+ it is necessary to replicate a given test run's randomness.
36
+
37
+ Background:
38
+ Given a file named "spec/random_spec.rb" with:
39
+ """ruby
40
+ require 'spec_helper'
41
+
42
+ describe 'randomized example' do
43
+ it 'prints random numbers' do
44
+ puts 5.times.map { rand(99) }.join("-")
45
+ end
46
+ end
47
+ """
48
+
49
+ Scenario: Specifying a seed using srand provides predictable randomization
50
+ Given a file named "spec/spec_helper.rb" with:
51
+ """ruby
52
+ srand 123
53
+ """
54
+ When I run `rspec`
55
+ Then the output should contain "66-92-98-17-83"
56
+
57
+ Scenario: Passing the RSpec seed to srand provides predictable randomization
58
+ Given a file named "spec/spec_helper.rb" with:
59
+ """ruby
60
+ srand RSpec.configuration.seed
61
+ """
62
+ When I run `rspec --seed 123`
63
+ Then the output should contain "66-92-98-17-83"
@@ -20,8 +20,8 @@ Feature: --require option
20
20
  super
21
21
  end
22
22
 
23
- def puts(message)
24
- [@file, __getobj__].each { |out| out.puts message }
23
+ def puts(*args)
24
+ [@file, __getobj__].each { |out| out.puts(*args) }
25
25
  end
26
26
 
27
27
  def close
@@ -14,7 +14,7 @@ Feature: run with ruby command
14
14
 
15
15
  describe 1 do
16
16
  it "is < 2" do
17
- 1.should be < 2
17
+ expect(1).to be < 2
18
18
  end
19
19
  end
20
20
  """
@@ -1,48 +1,39 @@
1
1
  Feature: alias_example_to
2
2
 
3
3
  Use `config.alias_example_to` to create new example group methods
4
- that define examples with the configured metadata.
4
+ that define examples with the configured metadata. You can also
5
+ specify metadata using only symbols.
5
6
 
6
- If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
7
- to `true`, you can specify metadata using only symbols.
8
-
9
- Scenario: Use alias_example_to to define focused example
7
+ Scenario: Use alias_example_to to define pending example
10
8
  Given a file named "alias_example_to_spec.rb" with:
11
9
  """ruby
12
10
  RSpec.configure do |c|
13
- c.alias_example_to :fit, :focused => true
14
- c.filter_run :focused => true
11
+ c.alias_example_to :pit, :pending => "Pit alias used"
15
12
  end
16
13
 
17
14
  describe "an example group" do
18
- it "does one thing" do
19
- end
20
-
21
- fit "does another thing" do
15
+ pit "does something later on" do
16
+ fail "not implemented yet"
22
17
  end
23
18
  end
24
19
  """
25
20
  When I run `rspec alias_example_to_spec.rb --format doc`
26
- Then the output should contain "does another thing"
27
- And the output should not contain "does one thing"
21
+ Then the output should contain "does something later on (PENDING: Pit alias used)"
22
+ And the output should contain "0 failures"
28
23
 
29
24
  Scenario: use symbols as metadata
30
25
  Given a file named "use_symbols_as_metadata_spec.rb" with:
31
26
  """ruby
32
27
  RSpec.configure do |c|
33
- c.treat_symbols_as_metadata_keys_with_true_values = true
34
- c.alias_example_to :fit, :focused
35
- c.filter_run :focused
28
+ c.alias_example_to :pit, :pending
36
29
  end
37
30
 
38
31
  describe "an example group" do
39
- it "does one thing" do
40
- end
41
-
42
- fit "does another thing" do
32
+ pit "does something later on" do
33
+ fail "not implemented yet"
43
34
  end
44
35
  end
45
36
  """
46
37
  When I run `rspec use_symbols_as_metadata_spec.rb --format doc`
47
- Then the output should contain "does another thing"
48
- And the output should not contain "does one thing"
38
+ Then the output should contain "does something later on (PENDING: No reason given)"
39
+ And the output should contain "0 failures"
@@ -1,6 +1,7 @@
1
- Feature: Backtrace cleaning
1
+ Feature: Excluding lines from the backtrace
2
2
 
3
- To aid in diagnozing spec failures, RSpec cleans matching lines from backtraces. The default patterns cleaned are:
3
+ To reduce the noise when diagnosing , RSpec excludes matching lines from
4
+ backtraces. The default exclusion patterns are:
4
5
 
5
6
  /\/lib\d*\/ruby\//,
6
7
  /org\/jruby\//,
@@ -9,14 +10,16 @@ Feature: Backtrace cleaning
9
10
  /spec\/spec_helper\.rb/,
10
11
  /lib\/rspec\/(core|expectations|matchers|mocks)/
11
12
 
12
- This list can be modified or replaced with the `backtrace_clean_patterns` option. Additionally, rspec can be run with the `--backtrace` option to skip backtrace cleaning entirely.
13
+ This list can be modified or replaced with the `backtrace_exclusion_patterns`
14
+ option. Additionally, rspec can be run with the `--backtrace` option to skip
15
+ backtrace cleaning entirely.
13
16
 
14
- Scenario: default configuration
17
+ Scenario: using default backtrace_exclusion_patterns
15
18
  Given a file named "spec/failing_spec.rb" with:
16
19
  """ruby
17
20
  describe "2 + 2" do
18
21
  it "is 5" do
19
- (2+2).should eq(5)
22
+ expect(2+2).to eq(5)
20
23
  end
21
24
  end
22
25
  """
@@ -24,11 +27,11 @@ Feature: Backtrace cleaning
24
27
  Then the output should contain "1 example, 1 failure"
25
28
  And the output should not contain "lib/rspec/expectations"
26
29
 
27
- Scenario: With a custom setting for backtrace_clean_patterns
30
+ Scenario: replacing backtrace_exclusion_patterns
28
31
  Given a file named "spec/spec_helper.rb" with:
29
32
  """ruby
30
33
  RSpec.configure do |config|
31
- config.backtrace_clean_patterns = [
34
+ config.backtrace_exclusion_patterns = [
32
35
  /spec_helper/
33
36
  ]
34
37
  end
@@ -42,7 +45,7 @@ Feature: Backtrace cleaning
42
45
  require 'spec_helper'
43
46
  describe "foo" do
44
47
  it "returns baz" do
45
- foo.should eq("baz")
48
+ expect(foo).to eq("baz")
46
49
  end
47
50
  end
48
51
  """
@@ -50,7 +53,7 @@ Feature: Backtrace cleaning
50
53
  Then the output should contain "1 example, 1 failure"
51
54
  And the output should contain "lib/rspec/expectations"
52
55
 
53
- Scenario: Adding a pattern
56
+ Scenario: appending to backtrace_exclusion_patterns
54
57
  Given a file named "spec/matchers/be_baz_matcher.rb" with:
55
58
  """ruby
56
59
  RSpec::Matchers.define :be_baz do |_|
@@ -62,12 +65,12 @@ Feature: Backtrace cleaning
62
65
  And a file named "spec/example_spec.rb" with:
63
66
  """ruby
64
67
  RSpec.configure do |config|
65
- config.backtrace_clean_patterns << /be_baz_matcher/
68
+ config.backtrace_exclusion_patterns << /be_baz_matcher/
66
69
  end
67
70
 
68
71
  describe "bar" do
69
72
  it "is baz" do
70
- "bar".should be_baz
73
+ expect("bar").to be_baz
71
74
  end
72
75
  end
73
76
  """
@@ -76,7 +79,7 @@ Feature: Backtrace cleaning
76
79
  But the output should not contain "be_baz_matcher"
77
80
  And the output should not contain "lib/rspec/expectations"
78
81
 
79
- Scenario: Running with the --backtrace option
82
+ Scenario: running rspec with the --backtrace option
80
83
  Given a file named "spec/matchers/be_baz_matcher.rb" with:
81
84
  """ruby
82
85
  RSpec::Matchers.define :be_baz do |_|
@@ -88,12 +91,12 @@ Feature: Backtrace cleaning
88
91
  And a file named "spec/example_spec.rb" with:
89
92
  """ruby
90
93
  RSpec.configure do |config|
91
- config.backtrace_clean_patterns << /be_baz_matcher/
94
+ config.backtrace_exclusion_patterns << /be_baz_matcher/
92
95
  end
93
96
 
94
97
  describe "bar" do
95
98
  it "is baz" do
96
- "bar".should be_baz
99
+ expect("bar").to be_baz
97
100
  end
98
101
  end
99
102
  """