Exclusion patterns not working as expected in Rails 4 when executing from project bin #919

Closed
kyleries opened this Issue Jan 28, 2014 · 2 comments

2 participants

@kyleries

RSpec Core's backtrace formatter allows configuring backtrace exclusions and inclusions to customize the trace presented for failing specs. However, it assumes that the RSpec executable is not in the project working directory (seen here and here, where the default inclusion parameter is set to the current working directory, and the decision on whether to include the line gives precedence to the inclusion pattern). Here's a gist of my backtrace and RSpec config before and after.

I'm not certain what the best RSpec ecosystem level fix ought to be here, but these are the options in mind:

  1. Include documentation in rspec-rails so folks are aware of needing to set backtrace_inclusion_patterns = [] for Rails 4 projects running RSpec from the project's bin to avoid getting the full backtrace in each failing example
  2. Update RSpec-rails default config block to set backtrace_inclusion_patterns = [] for Rails 4 projects
  3. Update RSpec core's BacktraceFormatter implementation to give more precedence to exclusion patterns when the executable is in the project's directory

Env Details
Ruby 2.1.0
Rails 4.0.2
RSpec 3.0.0.beta1 running from bin/

[EDIT] - Also wanted to say 'Thanks' to everyone working on RSpec! I'm happy to submit a PR for any of the above options, just wanted to get a feel for what might be the preferred option.

@cupakromer
RSpec member

Can you try 3.0.0.rc1? I am not able to reproduce the problem. I setup Ruby 2.1.1, Rails 4.1.1, RSpec 3.0.0.rc1.

I installed and setup the gems via: bundle --binstubs --path vendor/bundle

Running the spec was via: bin/rspec spec/controllers/foos_controller_spec.rb

@cupakromer
RSpec member

Closing as it doesn't appear reproducible any more. In general, backtrace issues are part of rspec-core. When consistent repo steps are available, consider logging the issue on core: https://github.com/rspec/rspec-core/issues/new

@cupakromer cupakromer closed this May 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment