Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Autotest regex only matches failures in spec files #178

Closed
ashmoran opened this Issue Oct 8, 2010 · 4 comments

Comments

Projects
None yet
2 participants

ashmoran commented Oct 8, 2010

The autotest output inspector only matches failures if the output lists the spec file as first line of the trace of the failure. Eg, this is detected as a failure:

Failures:
  1) Supermarket Checkout fails
     Failure/Error: def scan
     wrong number of arguments (1 for 0)
     # ./spec/supermarket_checkout/supermarket_checkout_spec.rb:22:in `scan'
     # ./spec/supermarket_checkout/supermarket_checkout_spec.rb:26:in `block (2 levels) in <module:SupermarketCheckout>'

but this is not:

 Failures:
   1) Supermarket Checkout an empty order
      Failure/Error: checkout.total.should eq 0
      wrong number of arguments (0 for 1)
      # ./lib/supermarket_checkout/supermarket_checkout.rb:7:in `total'
      # ./spec/supermarket_checkout/supermarket_checkout_spec.rb:11:in `block (2 levels) in <module:SupermarketCheckout>'

This appears to fix it:

def consolidate_failures(failed)
  filters = new_hash_of_arrays
  failed.each do |spec, trace|
    # if trace =~ /(.*spec\.rb)/
    if trace =~ /(.*\.rb)/
      filters[$1] << spec
    end
  end
  return filters
end

The code was last changed in this commit: http://github.com/rspec/rspec-core/commit/6f6ea2102dfd9bae4476c3e3fafaf05f83c8d4a7

Owner

dchelimsky commented Oct 8, 2010

Would you like to make that a proper patch, with specs?

ashmoran commented Oct 8, 2010

I'd love to but I don't have time right now, sorry. Ran into this on something that is already taking up more time than I can afford :-(

Owner

dchelimsky commented Oct 9, 2010

Fix bug with autotest failure-matching where it missed cases in which
the spec file wasn't the first line in the backtrace.

Thanks for fixing this. Sorry I couldn't help, but I assumed you'd want this fixed before the heat death of the universe.

timcharper pushed a commit to timcharper/rspec-core that referenced this issue Aug 19, 2011

Fix bug with autotest failure-matching where it missed cases in which
the spec file wasn't the first line in the backtrace.

- Closes #178.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment