Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change include/exclude for inclusion/exclusion in the backtrace cleaner

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
  • Loading branch information...
commit 09e740a3b3aab74510326c90a6c85eb9252f91c5 1 parent 0eb2545
@samphippen samphippen authored
View
18 lib/rspec/core/backtrace_cleaner.rb
@@ -2,8 +2,8 @@ module RSpec
module Core
class BacktraceCleaner
- DEFAULT_INCLUDE_PATTERNS = [Regexp.new(Dir.getwd)]
- DEFAULT_EXCLUDE_PATTERNS = [
+ DEFAULT_INCLUSION_PATTERNS = [Regexp.new(Dir.getwd)]
+ DEFAULT_EXCLUSION_PATTERNS = [
/\/lib\d*\/ruby\//,
/org\/jruby\//,
/bin\//,
@@ -12,20 +12,20 @@ class BacktraceCleaner
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
- attr_accessor :include_patterns
- attr_accessor :exclude_patterns
+ attr_accessor :inclusion_patterns
+ attr_accessor :exclusion_patterns
- def initialize(include_patterns=DEFAULT_INCLUDE_PATTERNS, exclude_patterns=DEFAULT_EXCLUDE_PATTERNS.dup)
- @include_patterns = include_patterns
- @exclude_patterns = exclude_patterns
+ def initialize(inclusion_patterns=DEFAULT_INCLUSION_PATTERNS.dup, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup)
+ @inclusion_patterns = inclusion_patterns
+ @exclusion_patterns = exclusion_patterns
end
def exclude?(line)
- @include_patterns.none? {|p| line =~ p} and @exclude_patterns.any? {|p| line =~ p}
+ @inclusion_patterns.none? {|p| line =~ p} and @exclusion_patterns.any? {|p| line =~ p}
end
def full_backtrace=(true_or_false)
- @exclude_patterns = true_or_false ? [] : DEFAULT_EXCLUDE_PATTERNS
+ @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup
end
end
end
View
24 lib/rspec/core/configuration.rb
@@ -286,30 +286,30 @@ def mock_framework=(framework)
def backtrace_clean_patterns
RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
- "RSpec::Core::Configuration#backtrace_exclude_patterns")
- @backtrace_cleaner.exclude_patterns
+ "RSpec::Core::Configuration#backtrace_exclusion_patterns")
+ @backtrace_cleaner.exclusion_patterns
end
def backtrace_clean_patterns=(patterns)
RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
- "RSpec::Core::Configuration#backtrace_exclude_patterns")
- @backtrace_cleaner.exclude_patterns = patterns
+ "RSpec::Core::Configuration#backtrace_exclusion_patterns")
+ @backtrace_cleaner.exclusion_patterns = patterns
end
- def backtrace_include_patterns
- @backtrace_cleaner.include_patterns
+ def backtrace_inclusion_patterns
+ @backtrace_cleaner.inclusion_patterns
end
- def backtrace_include_patterns=(patterns)
- @backtrace_cleaner.include_patterns = patterns
+ def backtrace_inclusion_patterns=(patterns)
+ @backtrace_cleaner.inclusion_patterns = patterns
end
- def backtrace_exclude_patterns
- @backtrace_cleaner.exclude_patterns
+ def backtrace_exclusion_patterns
+ @backtrace_cleaner.exclusion_patterns
end
- def backtrace_exclude_patterns=(patterns)
- @backtrace_cleaner.exclude_patterns = patterns
+ def backtrace_exclusion_patterns=(patterns)
+ @backtrace_cleaner.exclusion_patterns = patterns
end
# Sets the mock framework adapter module.
View
2  spec/rspec/core/configuration_spec.rb
@@ -949,7 +949,7 @@ def metadata_hash(*args)
context "given false" do
it "restores backtrace clean patterns" do
config.full_backtrace = false
- expect(config.backtrace_clean_patterns).to eq(RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUDE_PATTERNS)
+ expect(config.backtrace_clean_patterns).to eq(RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.