Permalink
Browse files

Rename backtrace_clean_patterns to backtrace_exclude_patterns

This also deprecates backtrace_clean_patterns

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
  • Loading branch information...
1 parent 78051dd commit ffe7c1fc95a7cf5c18e73694c665d078374e5814 @samphippen samphippen committed Mar 24, 2013
Showing with 51 additions and 3 deletions.
  1. +43 −3 lib/rspec/core/configuration.rb
  2. +8 −0 spec/rspec/core/configuration_spec.rb
@@ -90,7 +90,7 @@ def self.add_setting(name, opts={})
# To override this behavior and display a full backtrace, use
# `--backtrace` on the command line, in a `.rspec` file, or in the
# `rspec_options` attribute of RSpec's rake task.
- add_setting :backtrace_clean_patterns
+ add_setting :backtrace_exclude_patterns
add_setting :backtrace_include_patterns
# Path to use if no path is provided to the `rspec` command (default:
@@ -194,6 +194,8 @@ def self.add_setting(name, opts={})
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
+ attr_reader :backtrace_cleaner
+
def initialize
@expectation_frameworks = []
@include_or_extend_modules = []
@@ -203,8 +205,11 @@ def initialize
@color = false
@pattern = '**/*_spec.rb'
@failure_exit_code = 1
- @backtrace_clean_patterns = DEFAULT_BACKTRACE_PATTERNS.dup
+
+ @backtrace_exclude_patterns = DEFAULT_BACKTRACE_PATTERNS.dup
@backtrace_include_patterns = [Regexp.new(Dir.getwd)]
+ recreate_backtrace_cleaner
+
@default_path = 'spec'
@filter_manager = FilterManager.new
@preferred_options = {}
@@ -299,6 +304,37 @@ def mock_framework=(framework)
mock_with framework
end
+ def backtrace_clean_patterns
+ RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
+ "RSpec::Core::Configuration#backtrace_exclude_patterns")
+ backtrace_exclude_patterns
+ end
+
+ def backtrace_clean_patterns=(patterns)
+ RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
+ "RSpec::Core::Configuration#backtrace_exclude_patterns")
+ backtrace_exclude_patterns = patterns
+ recreate_backtrace_cleaner
+ end
+
+ def backtrace_include_patterns
+ @backtrace_include_patterns
+ end
+
+ def backtrace_include_patterns=(patterns)
+ @backtrace_include_patterns = patterns
+ recreate_backtrace_cleaner
+ end
+
+ def backtrace_exclude_patterns
+ @backtrace_exclude_patterns
+ end
+
+ def backtrace_exclude_patterns=(patterns)
+ @backtrace_exclude_patterns = patterns
+ recreate_backtrace_cleaner
+ end
+
# Sets the mock framework adapter module.
#
# `framework` can be a Symbol or a Module.
@@ -428,7 +464,7 @@ def expect_with(*frameworks)
end
def full_backtrace=(true_or_false)
- @backtrace_clean_patterns = true_or_false ? [] : DEFAULT_BACKTRACE_PATTERNS
+ @backtrace_exclude_patterns = true_or_false ? [] : DEFAULT_BACKTRACE_PATTERNS
end
def color(output=output_stream)
@@ -945,6 +981,10 @@ def order_groups_and_examples(&block)
private
+ def recreate_backtrace_cleaner
+ @backtrace_cleaner = BacktraceCleaner.new(@backtrace_include_patterns, @backtrace_exclude_patterns)
+ end
+
def get_files_to_run(paths)
patterns = pattern.split(",")
paths.map do |path|
@@ -962,6 +962,14 @@ def metadata_hash(*args)
end
end
+ describe "#backtrace_clean_patterns" do
+ it "is deprecated" do
+ RSpec.should_receive(:warn_deprecation)
+ config = Configuration.new
+ config.backtrace_clean_patterns
+ end
+ end
+
describe "#cleaned_from_backtrace? defaults" do
it "returns true for rspec files" do
expect(config.cleaned_from_backtrace?("lib/rspec/core.rb")).to be_true

0 comments on commit ffe7c1f

Please sign in to comment.