I am having a very frustrating problem running specs on my current
project. When I run tests en masse with “rake spec” or with autotest,
it frequently quits without completing all the tests. It also
sometimes runs the tests in multiple batches, giving more than one
result line for a single batch of tests.
For example, on my current project (which has in total 524 examples), it
currently runs a batch of 31 examples (with 0 failures), outputs a
result line, then runs a batch of 131 examples (with 3 failures),
outputs a result line, then reports “rake aborted” with “command failed”.
If I put --reverse in spec.opts, it quits in a different place after a
different number of specs.
If I run with --trace, it reports that the final complaint is in
spectask.rb line 177. This is a line that looks for error results when
it executes the command with system().
As far as I can tell, there is no way for me to know which spec file was
actually executing when it quit. Very frustrating.
System information:
OS X 10.5.5
Ruby 1.8.6
rspec 1.1.11
Below is an shell transcript. If this had run successfully, there
would be 524 examples run, instead of 31 and then 131. The particular
numbers change as I edit my files.
Thanks for any help, I’m tearing my hair out here.
-Evan
[17:16:12] unithrive$ rake spec --trace
(in /Users/evan/Development/Ruby/unithrive)
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:clone
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute spec
…F.FF…
‘LoanRequestsController responding to GET /loan_requests/new step 1
should assign step 1’ FAILED
expected: 1,
got: nil (using ==)
./spec/controllers/loan_requests_controller_spec.rb:130:
NoMethodError in ‘LoanRequestsController responding to GET
/loan_requests/new step 1 should create a new loan_request’
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.step
/Users/evan/Development/Ruby/unithrive/app/controllers/loan_requests_controller.rb:29:in
new' /Users/evan/Development/Ruby/unithrive/app/controllers/loan_requests_controller.rb:28:in
new’
./spec/controllers/loan_requests_controller_spec.rb:140:
Spec::Mocks::MockExpectationError in ‘LoanRequestsController responding
to GET /loan_requests/new step 1 should assign the new loan_request for
the view’
Mock ‘LoanRequest_1032’ received unexpected message :step with (no args)
/Users/evan/Development/Ruby/unithrive/app/controllers/loan_requests_controller.rb:29:in
new' /Users/evan/Development/Ruby/unithrive/app/controllers/loan_requests_controller.rb:28:in
new’
./spec/controllers/loan_requests_controller_spec.rb:145:
Finished in 6.80498 seconds
131 examples, 3 failures
…
Finished in 1.785438 seconds
31 examples, 0 failures
rake aborted!
Command
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
-I"/Users/evan/Development/Ruby/unithrive/vendor/plugins/rspec/lib"
“/Users/evan/Development/Ruby/unithrive/vendor/plugins/rspec/bin/spec”
“spec/controllers/activities_controller_spec.rb”
“spec/controllers/admin/forums_controller_spec.rb”
“spec/controllers/admin/people_controller_spec.rb”
“spec/controllers/admin/preferences_controller_spec.rb”
“spec/controllers/advanced_searches_controller_spec.rb”
“spec/controllers/advanced_searches_routing_spec.rb”
“spec/controllers/comments_controller_spec.rb”
“spec/controllers/connections_controller_spec.rb”
“spec/controllers/forums_controller_spec.rb”
“spec/controllers/home_controller_spec.rb”
“spec/controllers/loan_requests_controller_spec.rb”
“spec/controllers/loan_requests_routing_spec.rb”
“spec/controllers/messages_controller_spec.rb”
“spec/controllers/password_reminders_controller_spec.rb”
“spec/controllers/people_controller_spec.rb”
“spec/controllers/photos_controller_spec.rb”
“spec/controllers/posts_controller_spec.rb”
“spec/controllers/searches_controller_spec.rb”
“spec/controllers/sessions_controller_spec.rb”
“spec/controllers/topics_controller_spec.rb”
“spec/helpers/activities_helper_spec.rb”
“spec/helpers/advanced_searches_helper_spec.rb”
“spec/helpers/comments_helper_spec.rb”
“spec/helpers/communications_helper_spec.rb”
“spec/helpers/connections_helper_spec.rb”
“spec/helpers/forums_helper_spec.rb”
“spec/helpers/loan_requests_helper_spec.rb”
“spec/helpers/posts_helper_spec.rb”
“spec/helpers/preferences_helper_spec.rb”
“spec/helpers/searches_helper_spec.rb”
“spec/helpers/topics_helper_spec.rb” “spec/models/activity_spec.rb”
“spec/models/advanced_search_spec.rb” “spec/models/blog_post_spec.rb”
“spec/models/blog_spec.rb” “spec/models/comment_spec.rb”
“spec/models/connection_spec.rb” “spec/models/conversation_spec.rb”
“spec/models/email_verification_spec.rb” “spec/models/feed_spec.rb”
“spec/models/forum_post_spec.rb” “spec/models/forum_spec.rb”
“spec/models/loan_request_spec.rb” “spec/models/message_spec.rb”
“spec/models/person_mailer_spec.rb” “spec/models/person_spec.rb”
“spec/models/photo_spec.rb” “spec/models/preference_spec.rb”
“spec/models/topic_spec.rb”
“spec/views/advanced_searches/edit.html.erb_spec.rb”
“spec/views/advanced_searches/index.html.erb_spec.rb”
“spec/views/advanced_searches/new.html.erb_spec.rb”
“spec/views/advanced_searches/show.html.erb_spec.rb”
“spec/views/layouts/application.html.erb_spec.rb”
“spec/views/loan_requests/edit.html.erb_spec.rb”
“spec/views/loan_requests/index.html.erb_spec.rb”
“spec/views/loan_requests/new.html.erb_spec.rb”
“spec/views/loan_requests/show.html.erb_spec.rb”
“spec/views/people/show.html.erb_spec.rb” --options
“/Users/evan/Development/Ruby/unithrive/spec/spec.opts” failed
/Users/evan/Development/Ruby/unithrive/vendor/plugins/rspec/lib/spec/rake/spectask.rb:177:in
define' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1003:in
verbose’
/Users/evan/Development/Ruby/unithrive/vendor/plugins/rspec/lib/spec/rake/spectask.rb:153:in
define' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
call’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in execute' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
each’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in execute' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in
invoke_with_call_chain’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in synchronize' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
invoke_with_call_chain’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in invoke' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in
invoke_task’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
each’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
standard_exception_handling’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in
run’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in
run’
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/bin/rake:19:in `load’
/usr/bin/rake:19