Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fix a backtrace cleaning related spec. #228

merged 1 commit into from

2 participants


This spec failed when I did a fresh clean of rspec-expectations. It looks like stubbing backtrace_clean_patterns doesn't work now, this seems pretty sensible as these are now delegated to another object. I elected to just assign it in the before block. Is this sensible? Should I stub it on the backtrace cleaner instead?


Generally, I prefer assigning a config option rather than stubbing it, as it is not prone to this kind of problem. So, assigning it as have you done is good.

However, the config options are effectively global -- so when you assign it, you are changing a global value that can affect other specs. Can you add an after hook that resets the changed value to what it originally was?

@samphippen samphippen Fix a backtrace cleaning related spec.
Signed-off-by: Sam Phippen <>
@myronmarston myronmarston merged commit 453999e into from

Thanks, Sam!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2013
  1. @samphippen

    Fix a backtrace cleaning related spec.

    samphippen authored
    Signed-off-by: Sam Phippen <>
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +6 −1 spec/rspec/matchers/configuration_spec.rb
7 spec/rspec/matchers/configuration_spec.rb
@@ -22,7 +22,12 @@ module Matchers
before do
- RSpec.configuration.stub(:backtrace_clean_patterns) { [/clean-me/] }
+ @old_patterns = RSpec.configuration.backtrace_exclusion_patterns
+ RSpec.configuration.backtrace_exclusion_patterns = [/clean-me/]
+ end
+ after do
+ RSpec.configuration.backtrace_exclusion_patterns = @old_patterns
it "defaults to rspec-core's backtrace formatter when rspec-core is loaded" do
Something went wrong with that request. Please try again.