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'
describe UserDistributor do
…
describe '#scrape_sales_data' do
let(:ud) { FactoryGirl.create :user_distributor, :nook }
before do
allow_any_instance_of(DistributorWorker).to
receive(:scrape_sales_data_for_user).and_return(true)
end
subject { ud.scrape_sales_data }
it 'sets the user scrape_status field' do
expect { subject }.to change { ud.user.scrape_status }
end
it 'creates a distributor worker' do
expect(ud.distributor).to receve(:worker)
subject
end
it 'calls #scrape_sales_data_for_user on the distibutor worker with the UD'
do
expect_any_instance_of(DistributorWorker).to
receive(:scrape_sales_data_for_user).with(ud)
subject
end
end
end
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/B695317A-868B-4DF9-829B-62D84B6C1AB5%40pobox.com.