Permalink
Browse files

Suppport both true and false on config.full_backtrace=

- Closes #355.
  • Loading branch information...
1 parent 0c7a676 commit 2c71a88ba2ba4e7ba34c47185864d5417086be6c Andreas Tolf Tolfsen committed with dchelimsky May 5, 2011
Showing with 24 additions and 13 deletions.
  1. +1 −0 features/Changelog.md
  2. +11 −10 lib/rspec/core/configuration.rb
  3. +12 −3 spec/rspec/core/configuration_spec.rb
View
@@ -4,6 +4,7 @@
* Enhancements
* Restore --pattern/-P command line option from rspec-1
+ * Support false as well as true in config.full_backtrace= (Andreas Tolf Tolfsen)
### 2.6.0.rc4 / 2011-05-01
@@ -43,18 +43,19 @@ def self.add_setting(name, opts={})
:unless => lambda { |value| value }
}
+ DEFAULT_BACKTRACE_PATTERNS = [
+ /\/lib\d*\/ruby\//,
+ /bin\//,
+ /gems/,
+ /spec\/spec_helper\.rb/,
+ /lib\/rspec\/(core|expectations|matchers|mocks)/
+ ]
+
def initialize
@color_enabled = false
self.include_or_extend_modules = []
self.files_to_run = []
- self.backtrace_clean_patterns = [
- /\/lib\d*\/ruby\//,
- /bin\//,
- /gems/,
- /spec\/spec_helper\.rb/,
- /lib\/rspec\/(core|expectations|matchers|mocks)/
- ]
-
+ self.backtrace_clean_patterns = DEFAULT_BACKTRACE_PATTERNS.dup
self.exclusion_filter = CONDITIONAL_FILTERS.dup
end
@@ -210,8 +211,8 @@ def expect_with(*frameworks)
end
end
- def full_backtrace=(bool)
- settings[:backtrace_clean_patterns] = []
+ def full_backtrace=(true_or_false)
+ settings[:backtrace_clean_patterns] = true_or_false ? [] : DEFAULT_BACKTRACE_PATTERNS
end
def color_enabled
@@ -583,9 +583,18 @@ def metadata_hash(*args)
end
describe "#full_backtrace=" do
- it "clears the backtrace clean patterns" do
- config.full_backtrace = true
- config.backtrace_clean_patterns.should == []
+ context "given true" do
+ it "clears the backtrace clean patterns" do
+ config.full_backtrace = true
+ config.backtrace_clean_patterns.should == []
+ end
+ end
+
+ context "given false" do
+ it "restores backtrace clean patterns" do
+ config.full_backtrace = false
+ config.backtrace_clean_patterns.should == RSpec::Core::Configuration::DEFAULT_BACKTRACE_PATTERNS
+ end
end
it "doesn't impact other instances of config" do

0 comments on commit 2c71a88

Please sign in to comment.