title: How to debug a "TypeError: can't convert nil into String" with the traceback of rake tests?
body: <p>There are a lot of rake tests failing in a ruby on rails project [1], all with same error (can't convert nil into String), and I don't have any idea why is this happening neither how I should debug it.</p>
  
  <p>For example, this is the first tracebak of rake test (I have attached full rake test traceback at the end of the message [2]).</p>
  
  <pre><code>Error:
  test_update(Admin::BazarDistrictsControllerTest):
  TypeError: can't convert nil into String
      /usr/lib/ruby/1.9.1/psych.rb:154:in `parse'
      /usr/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
      /usr/lib/ruby/1.9.1/psych.rb:125:in `parse'
      /usr/lib/ruby/1.9.1/psych.rb:112:in `load' 
      /srv/www/gamersmafia/current/app/models/users_skill.rb:178:in `role_data_yaml'
      /srv/www/gamersmafia/current/app/models/alert.rb:200:in `block in update_pending_alerts'
      /srv/www/gamersmafia/current/app/models/alert.rb:198:in `each'
      /srv/www/gamersmafia/current/app/models/alert.rb:198:in `update_pending_alerts'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/performable_method.rb:26:in `perform'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:37:in `block in enqueue'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:36:in `tap'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:36:in `enqueue'
      /usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/message_sending.rb:13:in `method_missing'
      /srv/www/gamersmafia/current/app/models/alert.rb:182:in `block in update_pending_alerts'
      /srv/www/gamersmafia/current/app/models/alert.rb:180:in `each'
      /srv/www/gamersmafia/current/app/models/alert.rb:180:in `update_pending_alerts'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:460:in `_run__1673722312823048322__save__808729243992924512__callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/callbacks.rb:264:in `create_or_update'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/persistence.rb:84:in `save'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/validations.rb:50:in `save'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/dirty.rb:22:in `save'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:208:in `transaction'
      /usr/lib/ruby/gems/1.9.1/gems/deadlock_retry-1.2.0/lib/deadlock_retry.rb:31:in `transaction_with_deadlock_handling'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:259:in `block in save'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:258:in `save'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/persistence.rb:45:in `create'
      /srv/www/gamersmafia/current/app/models/bazar_district.rb:158:in `update_single_person_staff'
      /srv/www/gamersmafia/current/app/models/bazar_district.rb:83:in `update_don'
      /srv/www/gamersmafia/current/app/controllers/admin/bazar_districts_controller.rb:43:in `update'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:167:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rendering.rb:10:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:503:in `block in _run__1141341086633682237__process_action__2809844012775858444__callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_5310'
      /srv/www/gamersmafia/current/app/controllers/application_controller.rb:233:in `block (2 levels) in gm_process'
      /srv/www/gamersmafia/current/app/controllers/application_controller.rb:232:in `catch'
      /srv/www/gamersmafia/current/app/controllers/application_controller.rb:232:in `block in gm_process'
      /usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
      /srv/www/gamersmafia/current/app/controllers/application_controller.rb:231:in `gm_process'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_5310'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:469:in `_run__1141341086633682237__process_action__2809844012775858444__callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:17:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rescue.rb:29:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `block in instrument'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `instrument'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:121:in `process'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:45:in `process'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:473:in `process'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:49:in `process'
      /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:395:in `post'
      /srv/www/gamersmafia/current/test/functional/admin/bazar_districts_controller_test.rb:42:in `block in &lt;class:BazarDistrictsControllerTest&gt;'
  </code></pre>
  
  <p>And I have more than 200 test with errors of a total of 1448 tests.</p>
  
  <p>The question is, from where must I start to debug it? Why I'm getting same error in +90% of tests?</p>
  
  <p>[1] <a href="https://github.com/gamersmafia/gamersmafia" rel="nofollow">https://github.com/gamersmafia/gamersmafia</a></p>
  
  <p>[2] <a href="https://dl.dropbox.com/u/42306424/salida_rake.txt" rel="nofollow">https://dl.dropbox.com/u/42306424/salida_rake.txt</a></p>