Hi Jack Sorry for brevity, will reply in more detail later when I get to my computer. One thing I could spot is a typo in "receve" in one of the examples. There might be something wrong with the other examples, but I understand that you're looking for a generic solution how to quickly get what's wrong in a failure message, and clearly "undefined method" raised somewhere in RSpec's internals is nowhere near being helpful. I guess we'll have to dig whats in base_formatter.rb:209, that may give an idea of what is the root cause of missing exact failure messages. I'll check it out, but if you have a chance to take a look yourself earlier than I'll get to it, don't hesitate. RSpec is just as good as any other code, probably even easier to read and understand. - Phil
Running RSpec 2.99 (I know, I know, but I’m working on bringing my project up to date), and one section of one of my spec files gives that error. I’m not necessarily looking for a fix as much as a strategy for troubleshooting. Each of the three examples by itself will cause the same problem (both by isolating them on the command line and by commenting out the code). I also tried eliminating the “before” block (and FWIW, the call being tested works fine in production, not that that really means anything).
-- The section in question looks like: require 'spec_helper'
I get the following output (using —format documentation and —backtrace): UserDistributor #scrape_sales_data sets the user scrape_status field (FAILED - 1) creates a distributor worker (FAILED - 2) calls #scrape_sales_data_for_user on the distibutor worker with the UD (FAILED - 3) Failures: 1) UserDistributor#scrape_sales_data sets the user scrape_status field /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_formatter.rb:209:in `find_failed_line': undefined method `detect' for nil:NilClass (NoMethodError) from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_formatter.rb:191:in `read_failed_line' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_text_formatter.rb:300:in `dump_failure_info' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_text_formatter.rb:294:in `dump_failure' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_text_formatter.rb:24:in `block in dump_failures' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_text_formatter.rb:22:in `each' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_text_formatter.rb:22:in `each_with_index' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/formatters/base_text_formatter.rb:22:in `dump_failures' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:130:in `block in notify' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:129:in `each' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:129:in `notify' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:109:in `finish' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:60:in `report' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/command_line.rb:21:in `run' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:103:in `run' from /Users/jackrg/.rbenv/versions/2.0.0-p576/lib/ruby/gems/2.0.0/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:17:in `block in autorun' You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/B695317A-868B-4DF9-829B-62D84B6C1AB5%40pobox.com. You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/20200905075016.5840978.49327.7113%40gmail.com. |
- [rspec] undefined method `detect' for nil:NilClass (NoMe... Jack Royal-Gordon
- Re: [rspec] undefined method `detect' for nil:NilCl... Phil Pirozhkov
- Re: [rspec] undefined method `detect' for nil:N... Jack Royal-Gordon
- Re: [rspec] undefined method `detect' for n... Phil Pirozhkov
- Re: [rspec] undefined method `detect' for n... Jon Rowe
- Re: [rspec] undefined method `detect' f... Jack Royal-Gordon