rspec-core 2.14.8 → 2.99.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +8 -8
  2. data/Changelog.md +54 -8
  3. data/features/command_line/order.feature +5 -8
  4. data/features/configuration/custom_settings.feature +10 -10
  5. data/features/configuration/deprecation_stream.feature +3 -3
  6. data/features/configuration/read_options_from_file.feature +1 -1
  7. data/features/example_groups/shared_examples.feature +2 -2
  8. data/features/hooks/around_hooks.feature +1 -1
  9. data/features/metadata/current_example.feature +43 -4
  10. data/features/metadata/user_defined.feature +12 -12
  11. data/lib/autotest/rspec2.rb +60 -56
  12. data/lib/rspec/core.rb +40 -2
  13. data/lib/rspec/core/caller_filter.rb +55 -0
  14. data/lib/rspec/core/command_line.rb +2 -2
  15. data/lib/rspec/core/configuration.rb +201 -13
  16. data/lib/rspec/core/deprecation.rb +2 -7
  17. data/lib/rspec/core/example.rb +5 -8
  18. data/lib/rspec/core/example_group.rb +101 -17
  19. data/lib/rspec/core/filter_manager.rb +2 -2
  20. data/lib/rspec/core/formatters/deprecation_formatter.rb +173 -15
  21. data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -12
  22. data/lib/rspec/core/hooks.rb +1 -1
  23. data/lib/rspec/core/memoized_helpers.rb +49 -17
  24. data/lib/rspec/core/metadata.rb +1 -1
  25. data/lib/rspec/core/option_parser.rb +8 -3
  26. data/lib/rspec/core/pending.rb +14 -10
  27. data/lib/rspec/core/rake_task.rb +30 -6
  28. data/lib/rspec/core/runner.rb +9 -0
  29. data/lib/rspec/core/shared_example_group.rb +11 -9
  30. data/lib/rspec/core/shared_example_group/collection.rb +3 -1
  31. data/lib/rspec/core/version.rb +1 -2
  32. data/spec/command_line/order_spec.rb +4 -4
  33. data/spec/rspec/core/backtrace_cleaner_spec.rb +10 -10
  34. data/spec/rspec/core/caller_filter_spec.rb +58 -0
  35. data/spec/rspec/core/command_line_spec.rb +1 -0
  36. data/spec/rspec/core/configuration_options_spec.rb +6 -6
  37. data/spec/rspec/core/configuration_spec.rb +285 -52
  38. data/spec/rspec/core/deprecation_spec.rb +10 -29
  39. data/spec/rspec/core/deprecations_spec.rb +0 -14
  40. data/spec/rspec/core/example_group_spec.rb +74 -56
  41. data/spec/rspec/core/example_spec.rb +54 -17
  42. data/spec/rspec/core/filter_manager_spec.rb +2 -2
  43. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +156 -52
  44. data/spec/rspec/core/formatters/html_formatter_spec.rb +1 -1
  45. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +1 -2
  46. data/spec/rspec/core/hooks_spec.rb +2 -0
  47. data/spec/rspec/core/memoized_helpers_spec.rb +154 -113
  48. data/spec/rspec/core/metadata_spec.rb +25 -25
  49. data/spec/rspec/core/option_parser_spec.rb +19 -1
  50. data/spec/rspec/core/project_initializer_spec.rb +4 -4
  51. data/spec/rspec/core/rake_task_spec.rb +25 -4
  52. data/spec/rspec/core/shared_context_spec.rb +4 -4
  53. data/spec/rspec/core/shared_example_group_spec.rb +1 -1
  54. data/spec/rspec/core_spec.rb +36 -2
  55. data/spec/spec_helper.rb +3 -0
  56. data/spec/support/helper_methods.rb +16 -1
  57. data/spec/support/shared_example_groups.rb +1 -0
  58. data/spec/support/silence_dsl_deprecations.rb +32 -0
  59. metadata +10 -7
  60. data/spec/rspec/core/formatters/text_mate_formatted-2.1.0.html +0 -425
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTM2OGJjNTJkZDc1YzY0YjQyZjNkMzAxNmE5ZWMxZGMxZmU5ZDc2Zg==
4
+ MTdkZDRlZWFhNzlmYjQ5NmE0MDkxYzVlMjhmOGVkM2I5ZTgwYzZhOQ==
5
5
  data.tar.gz: !binary |-
6
- NjNkNjgwMDViNGQ0NjJiNzYyYzgyMTY4Njk4OGM1Y2EwZmYzOTg3Zg==
6
+ YmRhMTUxODliMzRmOTczZmZkYjAyNjk3NGFkMmY3MzRmYTY2MDVhZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODc0NWVjMjVjM2QxZDE3YTFiZmMwY2Y4MzY0NTg2OGFmZDJkNjMzOWM0ZTI4
10
- NWE2NDJhNmQ0ZmIwMDA1MzAyYjBmZWRkYmRhZTA1MTY0ODZhOWVlMWFlNjQz
11
- N2QxZmY2NjIwYzA4Nzk1ZjM0NzU4NzcxODcyZjI0ZWUyZjZlOTY=
9
+ YTZkZWQyOWRhMmE4NTRiNmRhY2I0Zjc1Mzg2MzgwYjFkNzdiYjBjNzI4ZGY5
10
+ YzZkNjdhZDhlOTMyNzFiZTBlMjE4MDQ4OTYxY2MwNzZhZjQ5ODdlODFmNDgx
11
+ N2YxNmY2MDczNWFhNWM4YjdlY2YwMjA5ZDZjMDNiZmMyMGIyMzg=
12
12
  data.tar.gz: !binary |-
13
- MzFiOTZkZWI3ZDFmMDg5ODMzY2M3ODdlYTI1MWVlOTI1OTU5OGI4OTYyNDkz
14
- OThkMWZiYTBkNmFkMmIzMThjZDc4OTI1NDY3OTNkZjc5NDYzNTcwMDUzNTFk
15
- NTE1MzA0MGE5YTg1Njg4OGQwM2M1ZDI1ZGJjODE4MTNjMDJkM2Q=
13
+ YjBlYmZlMTY4ZWI1NDQ5NDY3MTgzYWVkMGRjODE3NDJkNzk3MmUzNTU5ZmEw
14
+ NGY3NWE1YTRiMjMxNTdmMjJjOTk3ZjA0NDU3NTk5NGZhOTQ2ZDQ2NWJhM2Nj
15
+ ZDgxZmI0NzI5MWQ4ZjVhOGIwNmU0M2VhZWU3YmQ2MTc4MmNkY2I=
@@ -1,10 +1,55 @@
1
- ### 2.14.8 / 2014-02-27
2
- [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.7...v2.14.8)
1
+ ### 2.99.0.beta1 / 2013-11-07
2
+ [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.7...v2.99.0.beta1)
3
3
 
4
- Bug fixes:
4
+ Enhancements
5
5
 
6
- * Fix regression with the `TextMateFormatter` that prevented backtrace links
7
- from being clickable. (Stefan Daschek)
6
+ * Block-based DSL methods that run in the context of an example
7
+ (`it`, `before(:each)`, `after(:each)`, `let` and `subject`)
8
+ now yield the example as a block argument. (David Chelimsky)
9
+ * Warn when the name of more than one example group is submitted to
10
+ `include_examples` and it's aliases. (David Chelimsky)
11
+ * Add `expose_current_running_example_as` config option for
12
+ use during the upgrade process when external gems use the
13
+ deprecated `RSpec::Core::ExampleGroup#example` and
14
+ `RSpec::Core::ExampleGroup#running_example` methods. (Myron Marston)
15
+ * Limit spamminess of deprecation messages. (Bradley Schaefer, Loren Segal)
16
+ * Add `config.raise_errors_for_deprecations!` option, which turns
17
+ deprecations warnings into errors to surface the full backtrace
18
+ of the call site. (Myron Marston)
19
+
20
+ Deprecations
21
+
22
+ * Deprecate `RSpec::Core::ExampleGroup#example` and
23
+ `RSpec::Core::ExampleGroup#running_example` methods. If you need
24
+ access to the example (e.g. to get its metadata), use a block argument
25
+ instead. (David Chelimsky)
26
+ * Deprecate use of `autotest/rspec2` in favour of `rspec-autotest`. (Jon Rowe)
27
+ * Deprecate RSpec's built-in debugger support. Use a CLI option like
28
+ `-rruby-debug` (for the ruby-debug gem) or `-rdebugger` (for the
29
+ debugger gem) instead. (Myron Marston)
30
+ * Deprecate `RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values = false`.
31
+ RSpec 3 will not support having this option set to `false`. (Myron Marston)
32
+ * Deprecate accessing a `let` or `subject` declaration in
33
+ a `after(:all)` hook. (Myron Marston, Jon Rowe)
34
+ * Deprecate built-in `its` usage in favor of `rspec-its` gem due to planned
35
+ removal in RSpec 3. (Peter Alfvin)
36
+ * Deprecate `RSpec::Core::PendingExampleFixedError` in favor of
37
+ `RSpec::Core::Pending::PendingExampleFixedError`. (Myron Marston)
38
+ * Deprecate `RSpec::Core::Configuration#out` and
39
+ `RSpec::Core::Configuration#output` in favor of
40
+ `RSpec::Core::Configuration#output_stream`. (Myron Marston)
41
+ * Deprecate legacy ordering APIs.
42
+ * You should use `register_ordering(:global)` instead of these:
43
+ * `RSpec::Core::Configuration#order_examples`
44
+ * `RSpec::Core::Configuration#order_groups`
45
+ * `RSpec::Core::Configuration#order_groups_and_examples`
46
+ * These are deprecated with no replacement because in RSpec 3
47
+ ordering is a property of individual example groups rather than
48
+ just a global property of the entire test suite:
49
+ * `RSpec::Core::Configuration#order`
50
+ * `RSpec::Core::Configuration#randomize?`
51
+ * `--order default` is deprecated in favor of `--order defined`
52
+ (Myron Marston)
8
53
 
9
54
  ### 2.14.7 / 2013-10-29
10
55
  [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.6...v2.14.7)
@@ -27,7 +72,8 @@ Bug fixes:
27
72
 
28
73
  * Format stringified numbers correctly when mathn library is loaded.
29
74
  (Jay Hayes)
30
- * Fix an issue that prevented the use of frozen error objects. (Lars Gierth)
75
+ * Fix an issue that prevented the use of frozen error objects. (Lars
76
+ Gierth)
31
77
 
32
78
  ### 2.14.5 / 2013-08-13
33
79
  [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.4...v2.14.5)
@@ -106,7 +152,7 @@ Enhancements
106
152
  * Apply focus to examples defined with `fit` (equivalent of
107
153
  `it "description", focus: true`) (Michael de Silva)
108
154
 
109
- Bug fixes
155
+ Bug fix
110
156
 
111
157
  * Ensure methods defined by `let` take precedence over others
112
158
  when there is a name collision (e.g. from an included module).
@@ -141,7 +187,7 @@ Enhancements
141
187
  (Konstantin Haase).
142
188
  * Add cucumber documentation for --require command line option
143
189
  (Bradley Schaefer)
144
- * Expose configruation options via config:
190
+ * Expose configuration options via config:
145
191
  * `config.libs` returns the libs configured to be added onto the load path
146
192
  * `full_backtrace?` returns the state of the backtrace cleaner
147
193
  * `debug?` returns true when the debugger is loaded
@@ -1,13 +1,10 @@
1
1
  Feature: --order (new in rspec-core-2.8)
2
2
 
3
3
  Use the `--order` option to tell RSpec how to order the files, groups, and
4
- examples. Options are `default` and `rand`:
4
+ examples. Options are `defined` and `rand`.
5
5
 
6
- Default is:
7
-
8
- * files are ordered based on the underlying file system's order (typically
9
- case-sensitive alpha on *nix OS's and case-insenstive alpha in Windows)
10
- * groups/examples are loaded in the order in which they are declared
6
+ `defined` is the default, which executes groups and examples in the
7
+ order they are defined as the spec files are loaded.
11
8
 
12
9
  Use `rand` to randomize the order of files, groups within files, and
13
10
  examples within groups.*
@@ -20,10 +17,10 @@ Feature: --order (new in rspec-core-2.8)
20
17
 
21
18
  <h3>Examples</h3>
22
19
 
23
- --order default
20
+ --order defined
24
21
  --order rand
25
22
  --order rand:123
26
23
  --seed 123 # same as --order rand:123
27
24
 
28
- The `default` option is only necessary when you have `--order rand` stored in a
25
+ The `defined` option is only necessary when you have `--order rand` stored in a
29
26
  config file (e.g. `.rspec`) and you want to override it from the command line.
@@ -15,17 +15,17 @@ Feature: custom settings
15
15
  end
16
16
 
17
17
  it "acts false by default" do
18
- RSpec.configuration.custom_setting.should be_false
18
+ RSpec.configuration.custom_setting.should be_falsey
19
19
  end
20
20
 
21
21
  it "is exposed as a predicate" do
22
- RSpec.configuration.custom_setting?.should be_false
22
+ RSpec.configuration.custom_setting?.should be_falsey
23
23
  end
24
24
 
25
25
  it "can be overridden" do
26
26
  RSpec.configuration.custom_setting = true
27
- RSpec.configuration.custom_setting.should be_true
28
- RSpec.configuration.custom_setting?.should be_true
27
+ RSpec.configuration.custom_setting.should be_truthy
28
+ RSpec.configuration.custom_setting?.should be_truthy
29
29
  end
30
30
  end
31
31
  """
@@ -41,17 +41,17 @@ Feature: custom settings
41
41
 
42
42
  describe "custom setting" do
43
43
  it "is true by default" do
44
- RSpec.configuration.custom_setting.should be_true
44
+ RSpec.configuration.custom_setting.should be_truthy
45
45
  end
46
46
 
47
47
  it "is exposed as a predicate" do
48
- RSpec.configuration.custom_setting?.should be_true
48
+ RSpec.configuration.custom_setting?.should be_truthy
49
49
  end
50
50
 
51
51
  it "can be overridden" do
52
52
  RSpec.configuration.custom_setting = false
53
- RSpec.configuration.custom_setting.should be_false
54
- RSpec.configuration.custom_setting?.should be_false
53
+ RSpec.configuration.custom_setting.should be_falsey
54
+ RSpec.configuration.custom_setting?.should be_falsey
55
55
  end
56
56
  end
57
57
  """
@@ -71,11 +71,11 @@ Feature: custom settings
71
71
 
72
72
  describe "custom setting" do
73
73
  it "returns the value set in the last cofigure block to get eval'd" do
74
- RSpec.configuration.custom_setting.should be_true
74
+ RSpec.configuration.custom_setting.should be_truthy
75
75
  end
76
76
 
77
77
  it "is exposed as a predicate" do
78
- RSpec.configuration.custom_setting?.should be_true
78
+ RSpec.configuration.custom_setting?.should be_truthy
79
79
  end
80
80
  end
81
81
  """
@@ -27,7 +27,7 @@ Feature: deprecation_stream
27
27
  end
28
28
  """
29
29
  When I run `rspec spec/example_spec.rb`
30
- Then the output should contain "DEPRECATION: Foo#bar is deprecated"
30
+ Then the output should contain "Deprecation Warnings:\n\nFoo#bar is deprecated"
31
31
 
32
32
  Scenario: configure using the path to a file
33
33
  Given a file named "spec/example_spec.rb" with:
@@ -39,7 +39,7 @@ Feature: deprecation_stream
39
39
  end
40
40
  """
41
41
  When I run `rspec spec/example_spec.rb`
42
- Then the output should not contain "DEPRECATION"
42
+ Then the output should not contain "Deprecation Warnings:"
43
43
  But the output should contain "1 deprecation logged to deprecations.txt"
44
44
  And the file "deprecations.txt" should contain "Foo#bar is deprecated"
45
45
 
@@ -53,6 +53,6 @@ Feature: deprecation_stream
53
53
  end
54
54
  """
55
55
  When I run `rspec spec/example_spec.rb`
56
- Then the output should not contain "DEPRECATION"
56
+ Then the output should not contain "Deprecation Warnings:"
57
57
  But the output should contain "1 deprecation logged to deprecations.txt"
58
58
  And the file "deprecations.txt" should contain "Foo#bar is deprecated"
@@ -66,7 +66,7 @@ Feature: read command line configuration options from files
66
66
  """ruby
67
67
  describe "custom options file" do
68
68
  it "causes .rspec to be ignored" do
69
- RSpec.configuration.color_enabled.should be_false
69
+ RSpec.configuration.color_enabled.should be_falsey
70
70
  end
71
71
  end
72
72
  """
@@ -53,13 +53,13 @@ Feature: shared examples
53
53
  describe "#include?" do
54
54
  context "with an an item that is in the collection" do
55
55
  it "returns true" do
56
- collection.include?(7).should be_true
56
+ collection.include?(7).should be_truthy
57
57
  end
58
58
  end
59
59
 
60
60
  context "with an an item that is not in the collection" do
61
61
  it "returns false" do
62
- collection.include?(9).should be_false
62
+ collection.include?(9).should be_falsey
63
63
  end
64
64
  end
65
65
  end
@@ -192,7 +192,7 @@ Feature: around hooks
192
192
  end
193
193
 
194
194
  it "runs the example in the correct context" do
195
- included_in_configure_block.should be_true
195
+ included_in_configure_block.should be_truthy
196
196
  end
197
197
  end
198
198
  """
@@ -1,14 +1,53 @@
1
1
  Feature: current example
2
2
 
3
3
  You can reference the example object, and access its metadata, using
4
- the `example` method within an example.
4
+ a block argument to it, before and after hooks, let, and subject.
5
5
 
6
6
  Scenario: access the example object from within an example
7
7
  Given a file named "spec/example_spec.rb" with:
8
8
  """ruby
9
- describe "an example" do
10
- it "knows itself as example" do
11
- example.description.should eq("knows itself as example")
9
+ describe "example as block arg to it, before, and after" do
10
+ before do |example|
11
+ expect(example.description).to eq("is the example object")
12
+ end
13
+
14
+ after do |example|
15
+ expect(example.description).to eq("is the example object")
16
+ end
17
+
18
+ it "is the example object" do |example|
19
+ expect(example.description).to eq("is the example object")
20
+ end
21
+ end
22
+
23
+ describe "example as block arg to let" do
24
+ let(:the_description) do |example|
25
+ example.description
26
+ end
27
+
28
+ it "is the example object" do |example|
29
+ expect(the_description).to eq("is the example object")
30
+ end
31
+ end
32
+
33
+ describe "example as block arg to subject" do
34
+ subject do |example|
35
+ example.description
36
+ end
37
+
38
+ it "is the example object" do |example|
39
+ expect(subject).to eq("is the example object")
40
+ end
41
+ end
42
+
43
+ describe "example as block arg to subject with a name" do
44
+ subject(:the_subject) do |example|
45
+ example.description
46
+ end
47
+
48
+ it "is the example object" do |example|
49
+ expect(the_subject).to eq("is the example object")
50
+ expect(subject).to eq("is the example object")
12
51
  end
13
52
  end
14
53
  """
@@ -25,20 +25,20 @@ Feature: User-defined metadata
25
25
  Given a file named "define_group_metadata_with_hash_spec.rb" with:
26
26
  """ruby
27
27
  describe "a group with user-defined metadata", :foo => 17 do
28
- it 'has access to the metadata in the example' do
28
+ it 'has access to the metadata in the example' do |example|
29
29
  example.metadata[:foo].should eq(17)
30
30
  end
31
31
 
32
- it 'does not have access to metadata defined on sub-groups' do
32
+ it 'does not have access to metadata defined on sub-groups' do |example|
33
33
  example.metadata.should_not include(:bar)
34
34
  end
35
35
 
36
36
  describe 'a sub-group with user-defined metadata', :bar => 12 do
37
- it 'has access to the sub-group metadata' do
37
+ it 'has access to the sub-group metadata' do |example|
38
38
  example.metadata[:foo].should eq(17)
39
39
  end
40
40
 
41
- it 'also has access to metadata defined on parent groups' do
41
+ it 'also has access to metadata defined on parent groups' do |example|
42
42
  example.metadata[:bar].should eq(12)
43
43
  end
44
44
  end
@@ -51,12 +51,12 @@ Feature: User-defined metadata
51
51
  Given a file named "define_example_metadata_with_hash_spec.rb" with:
52
52
  """ruby
53
53
  describe "a group with no user-defined metadata" do
54
- it 'has an example with metadata', :foo => 17 do
54
+ it 'has an example with metadata', :foo => 17 do |example|
55
55
  example.metadata[:foo].should eq(17)
56
56
  example.metadata.should_not include(:bar)
57
57
  end
58
58
 
59
- it 'has another example with metadata', :bar => 12, :bazz => 33 do
59
+ it 'has another example with metadata', :bar => 12, :bazz => 33 do |example|
60
60
  example.metadata[:bar].should eq(12)
61
61
  example.metadata[:bazz].should eq(33)
62
62
  example.metadata.should_not include(:foo)
@@ -70,12 +70,12 @@ Feature: User-defined metadata
70
70
  Given a file named "override_metadata_spec.rb" with:
71
71
  """ruby
72
72
  describe "a group with user-defined metadata", :foo => 'bar' do
73
- it 'can be overridden by an example', :foo => 'bazz' do
73
+ it 'can be overridden by an example', :foo => 'bazz' do |example|
74
74
  example.metadata[:foo].should == 'bazz'
75
75
  end
76
76
 
77
77
  describe "a sub-group with an override", :foo => 'goo' do
78
- it 'can be overridden by a sub-group' do
78
+ it 'can be overridden by a sub-group' do |example|
79
79
  example.metadata[:foo].should == 'goo'
80
80
  end
81
81
  end
@@ -92,19 +92,19 @@ Feature: User-defined metadata
92
92
  end
93
93
 
94
94
  describe "a group with simple metadata", :fast, :simple, :bug => 73 do
95
- it 'has `:fast => true` metadata' do
95
+ it 'has `:fast => true` metadata' do |example|
96
96
  example.metadata[:fast].should == true
97
97
  end
98
98
 
99
- it 'has `:simple => true` metadata' do
99
+ it 'has `:simple => true` metadata' do |example|
100
100
  example.metadata[:simple].should == true
101
101
  end
102
102
 
103
- it 'can still use a hash for metadata' do
103
+ it 'can still use a hash for metadata' do |example|
104
104
  example.metadata[:bug].should eq(73)
105
105
  end
106
106
 
107
- it 'can define simple metadata on an example', :special do
107
+ it 'can define simple metadata on an example', :special do |example|
108
108
  example.metadata[:special].should == true
109
109
  end
110
110
  end
@@ -1,73 +1,77 @@
1
- require 'autotest'
2
- require 'rspec/core/deprecation'
1
+ begin
2
+ require 'rspec/autotest'
3
+ rescue LoadError
4
+ require 'autotest'
3
5
 
4
- # Derived from the `Autotest` class, extends the `autotest` command to work
5
- # with RSpec.
6
- #
7
- # @note this will be extracted to a separate gem when we release rspec-3.
8
- class Autotest::Rspec2 < Autotest
6
+ # Derived from the `Autotest` class, extends the `autotest` command to work
7
+ # with RSpec.
8
+ #
9
+ # @note this will be extracted to a separate gem when we release rspec-3.
10
+ class Autotest::Rspec2 < Autotest
9
11
 
10
- RSPEC_EXECUTABLE = File.expand_path('../../../exe/rspec', __FILE__)
12
+ RSPEC_EXECUTABLE = File.expand_path('../../../exe/rspec', __FILE__)
11
13
 
12
- def initialize
13
- super()
14
- clear_mappings
15
- setup_rspec_project_mappings
14
+ def initialize
15
+ super()
16
+ clear_mappings
17
+ setup_rspec_project_mappings
16
18
 
17
- # Example for Ruby 1.8: http://rubular.com/r/AOXNVDrZpx
18
- # Example for Ruby 1.9: http://rubular.com/r/85ag5AZ2jP
19
- self.failed_results_re = /^\s*\d+\).*\n\s+(?:\e\[\d*m)?Failure.*(\n(?:\e\[\d*m)?\s+#\s(.*)?:\d+(?::.*)?(?:\e\[\d*m)?)+$/m
20
- self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
21
- end
19
+ # Example for Ruby 1.8: http://rubular.com/r/AOXNVDrZpx
20
+ # Example for Ruby 1.9: http://rubular.com/r/85ag5AZ2jP
21
+ self.failed_results_re = /^\s*\d+\).*\n\s+(?:\e\[\d*m)?Failure.*(\n(?:\e\[\d*m)?\s+#\s(.*)?:\d+(?::.*)?(?:\e\[\d*m)?)+$/m
22
+ self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
23
+ end
22
24
 
23
- # Adds conventional spec-to-file mappings to Autotest configuation.
24
- def setup_rspec_project_mappings
25
- add_mapping(%r%^spec/.*_spec\.rb$%) { |filename, _|
26
- filename
27
- }
28
- add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
29
- ["spec/#{m[1]}_spec.rb"]
30
- }
31
- add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
32
- files_matching %r%^spec/.*_spec\.rb$%
33
- }
34
- end
25
+ # Adds conventional spec-to-file mappings to Autotest configuation.
26
+ def setup_rspec_project_mappings
27
+ add_mapping(%r%^spec/.*_spec\.rb$%) { |filename, _|
28
+ filename
29
+ }
30
+ add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
31
+ ["spec/#{m[1]}_spec.rb"]
32
+ }
33
+ add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
34
+ files_matching %r%^spec/.*_spec\.rb$%
35
+ }
36
+ end
35
37
 
36
- # Overrides Autotest's implementation to read rspec output
37
- def consolidate_failures(failed)
38
- filters = new_hash_of_arrays
39
- failed.each do |spec, trace|
40
- if trace =~ /(.*spec\.rb)/
41
- filters[$1] << spec
38
+ # Overrides Autotest's implementation to read rspec output
39
+ def consolidate_failures(failed)
40
+ filters = new_hash_of_arrays
41
+ failed.each do |spec, trace|
42
+ if trace =~ /(.*spec\.rb)/
43
+ filters[$1] << spec
44
+ end
42
45
  end
46
+ return filters
43
47
  end
44
- return filters
45
- end
46
48
 
47
- # Overrides Autotest's implementation to generate the rspec command to run
48
- def make_test_cmd(files_to_test)
49
- files_to_test.empty? ? '' :
50
- %|#{prefix}"#{ruby}"#{suffix} -S "#{RSPEC_EXECUTABLE}" --tty #{normalize(files_to_test).keys.flatten.map { |f| %|"#{f}"|}.join(' ')}|
51
- end
49
+ # Overrides Autotest's implementation to generate the rspec command to run
50
+ def make_test_cmd(files_to_test)
51
+ files_to_test.empty? ? '' :
52
+ %|#{prefix}"#{ruby}"#{suffix} -S "#{RSPEC_EXECUTABLE}" --tty #{normalize(files_to_test).keys.flatten.map { |f| %|"#{f}"|}.join(' ')}|
53
+ end
52
54
 
53
- # Generates a map of filenames to Arrays for Autotest
54
- def normalize(files_to_test)
55
- files_to_test.keys.inject({}) do |result, filename|
56
- result.merge!(File.expand_path(filename) => [])
55
+ # Generates a map of filenames to Arrays for Autotest
56
+ def normalize(files_to_test)
57
+ files_to_test.keys.inject({}) do |result, filename|
58
+ result.merge!(File.expand_path(filename) => [])
59
+ end
57
60
  end
58
- end
59
61
 
60
- private
62
+ private
61
63
 
62
- def suffix
63
- using_bundler? ? "" : defined?(:Gem) ? " -rrubygems" : ""
64
- end
64
+ def suffix
65
+ using_bundler? ? "" : defined?(:Gem) ? " -rrubygems" : ""
66
+ end
65
67
 
66
- def using_bundler?
67
- prefix =~ /bundle exec/
68
- end
68
+ def using_bundler?
69
+ prefix =~ /bundle exec/
70
+ end
69
71
 
70
- def gemfile?
71
- File.exist?('./Gemfile')
72
+ def gemfile?
73
+ File.exist?('./Gemfile')
74
+ end
72
75
  end
76
+ Autotest.add_hook(:ran_command) { warn "\n\e[31mUsing the built in rspec-core autotest support is deprecated and will be removed in RSpec 3. Please switch to the rspec-autotest gem\e[0m" }
73
77
  end