Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 38c563b

Browse files
author
Sam Phippen
committed
Merge pull request #923 from samphippen/remove-backtrace-clean-patterns
Remove #backtrace_clean_patterns.
2 parents 38b3a13 + b8e8bee commit 38c563b

File tree

4 files changed

+18
-46
lines changed

4 files changed

+18
-46
lines changed

features/configuration/backtrace_clean_patterns.feature renamed to features/configuration/backtrace_exclusion_patterns.feature

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Feature: Backtrace cleaning
1+
Feature: Excluding lines from the backtrace
22

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:
45

56
/\/lib\d*\/ruby\//,
67
/org\/jruby\//,
@@ -9,9 +10,11 @@ Feature: Backtrace cleaning
910
/spec\/spec_helper\.rb/,
1011
/lib\/rspec\/(core|expectations|matchers|mocks)/
1112

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.
1316

14-
Scenario: default configuration
17+
Scenario: using default backtrace_exclusion_patterns
1518
Given a file named "spec/failing_spec.rb" with:
1619
"""ruby
1720
describe "2 + 2" do
@@ -24,11 +27,11 @@ Feature: Backtrace cleaning
2427
Then the output should contain "1 example, 1 failure"
2528
And the output should not contain "lib/rspec/expectations"
2629

27-
Scenario: With a custom setting for backtrace_clean_patterns
30+
Scenario: replacing backtrace_exclusion_patterns
2831
Given a file named "spec/spec_helper.rb" with:
2932
"""ruby
3033
RSpec.configure do |config|
31-
config.backtrace_clean_patterns = [
34+
config.backtrace_exclusion_patterns = [
3235
/spec_helper/
3336
]
3437
end
@@ -50,7 +53,7 @@ Feature: Backtrace cleaning
5053
Then the output should contain "1 example, 1 failure"
5154
And the output should contain "lib/rspec/expectations"
5255

53-
Scenario: Adding a pattern
56+
Scenario: appending to backtrace_exclusion_patterns
5457
Given a file named "spec/matchers/be_baz_matcher.rb" with:
5558
"""ruby
5659
RSpec::Matchers.define :be_baz do |_|
@@ -62,7 +65,7 @@ Feature: Backtrace cleaning
6265
And a file named "spec/example_spec.rb" with:
6366
"""ruby
6467
RSpec.configure do |config|
65-
config.backtrace_clean_patterns << /be_baz_matcher/
68+
config.backtrace_exclusion_patterns << /be_baz_matcher/
6669
end
6770
6871
describe "bar" do
@@ -76,7 +79,7 @@ Feature: Backtrace cleaning
7679
But the output should not contain "be_baz_matcher"
7780
And the output should not contain "lib/rspec/expectations"
7881

79-
Scenario: Running with the --backtrace option
82+
Scenario: running rspec with the --backtrace option
8083
Given a file named "spec/matchers/be_baz_matcher.rb" with:
8184
"""ruby
8285
RSpec::Matchers.define :be_baz do |_|
@@ -88,7 +91,7 @@ Feature: Backtrace cleaning
8891
And a file named "spec/example_spec.rb" with:
8992
"""ruby
9093
RSpec.configure do |config|
91-
config.backtrace_clean_patterns << /be_baz_matcher/
94+
config.backtrace_exclusion_patterns << /be_baz_matcher/
9295
end
9396
9497
describe "bar" do

lib/rspec/core/configuration.rb

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -284,29 +284,6 @@ def mock_framework=(framework)
284284
mock_with framework
285285
end
286286

287-
# The patterns to discard from backtraces. Deprecated, use
288-
# Configuration#backtrace_exclusion_patterns instead
289-
#
290-
# Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS
291-
#
292-
# One can replace the list by using the setter or modify it through the
293-
# getter
294-
#
295-
# To override this behaviour and display a full backtrace, use
296-
# `--backtrace`on the command line, in a `.rspec` file, or in the
297-
# `rspec_options` attribute of RSpec's rake task.
298-
def backtrace_clean_patterns
299-
RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
300-
:replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
301-
@backtrace_cleaner.exclusion_patterns
302-
end
303-
304-
def backtrace_clean_patterns=(patterns)
305-
RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
306-
:replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
307-
@backtrace_cleaner.exclusion_patterns = patterns
308-
end
309-
310287
# The patterns to always include to backtraces.
311288
#
312289
# Defaults to [Regexp.new Dir.getwd] if the current working directory

lib/rspec/core/mocking/with_rr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rr'
22

3-
RSpec.configuration.backtrace_clean_patterns.push(RR::Errors::BACKTRACE_IDENTIFIER)
3+
RSpec.configuration.backtrace_exclusion_patterns.push(RR::Errors::BACKTRACE_IDENTIFIER)
44

55
module RSpec
66
module Core

spec/rspec/core/configuration_spec.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,11 +1016,10 @@ def metadata_hash(*args)
10161016
end
10171017
end
10181018

1019-
describe "#backtrace_clean_patterns=" do
1019+
describe "#backtrace_exclusion_patterns=" do
10201020
it "actually receives the new filter values" do
1021-
RSpec.stub(:deprecate)
10221021
config = Configuration.new
1023-
config.backtrace_clean_patterns = [/.*/]
1022+
config.backtrace_exclusion_patterns = [/.*/]
10241023
expect(config.backtrace_cleaner.exclude? "this").to be_true
10251024
end
10261025
end
@@ -1037,17 +1036,10 @@ def metadata_hash(*args)
10371036
end
10381037
end
10391038

1040-
describe "#backtrace_clean_patterns" do
1041-
before { allow(RSpec).to receive(:deprecate) }
1042-
it "is deprecated" do
1043-
RSpec.should_receive(:deprecate)
1044-
config = Configuration.new
1045-
config.backtrace_clean_patterns
1046-
end
1047-
1039+
describe "#backtrace_exclusion_patterns" do
10481040
it "can be appended to" do
10491041
config = Configuration.new
1050-
config.backtrace_clean_patterns << /.*/
1042+
config.backtrace_exclusion_patterns << /.*/
10511043
expect(config.backtrace_cleaner.exclude? "this").to be_true
10521044
end
10531045
end

0 commit comments

Comments
 (0)