Failure/Error: Unable to find matching line from backtrace can't convert nil into String

I’m getting this errors from this spec:
http://pastie.org/private/lm9nrqnmhqobs1avf3skgw

Failures:

  1. Account Account should have a relation belongs to with customer
    Failure/Error: Unable to find matching line from backtrace
    can’t convert nil into String

    D:\ruby\rubies\jruby-1.5.2\bin\rspec:19

  2. Account Account should have a relation belongs to with account
    status
    Failure/Error: Unable to find matching line from backtrace
    can’t convert nil into String

    D:\ruby\rubies\jruby-1.5.2\bin\rspec:19

  3. Account Account should have a has many relation with account
    managers
    Failure/Error: Unable to find matching line from backtrace
    can’t convert nil into String

    D:\ruby\rubies\jruby-1.5.2\bin\rspec:19

  4. Account Account should have a has many relation with account
    relations
    Failure/Error: Unable to find matching line from backtrace
    can’t convert nil into String

    D:\ruby\rubies\jruby-1.5.2\bin\rspec:19

  5. Account Account should be possible to create an account with only
    status, b
    ucket and creation_date
    Failure/Error: Unable to find matching line from backtrace
    can’t convert nil into String

    D:\ruby\rubies\jruby-1.5.2\bin\rspec:19

  6. Account Account should return an error if bucket is nil
    Failure/Error: Unable to find matching line from backtrace
    can’t convert nil into String

    D:\ruby\rubies\jruby-1.5.2\bin\rspec:19

The spec is very simple. This was working with rails2+rspec1.3… I’m
using rails3+rspec2 now. The error message is not very clear.

Any idea why this happens?

On Sep 21, 2010, at 10:58 AM, Bruno C. wrote:

Any idea why this happens?

http://github.com/rspec/rspec-core/issues#issue/146

Hi David,

Thanks for the reply but that didn’t fix my problem.

I think this is somehow related to fixtures, at least I only get this
problem on the specs that use fixtures and if I remove the fixtures,
it works.

TypeError: can’t convert nil into String
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/
lib/active_record/fixtures.rb:519:in create_fixtures' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/ lib/active_record/fixtures.rb:518:inmap’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/
lib/active_record/fixtures.rb:518:in create_fixtures' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-jdbc- adapter-0.9.7-java/lib/jdbc_adapter/jdbc_mysql.rb:141:indisable_referential_integrity’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/
lib/active_record/fixtures.rb:515:in create_fixtures' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activesupport-3.0.0/ lib/active_support/benchmarkable.rb:55:insilence’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/
lib/active_record/fixtures.rb:514:in create_fixtures' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/ lib/active_record/fixtures.rb:975:inload_fixtures’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0/
lib/active_record/fixtures.rb:950:in setup_fixtures' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- rails-2.0.0.beta.22/lib/rspec/rails/adapters.rb:11:insetup’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/hooks.rb:29:in instance_eval' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/hooks.rb:29:inrun_in’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/hooks.rb:60:in run_all' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/hooks.rb:60:ineach’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/hooks.rb:60:in run_all' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/hooks.rb:103:inrun_hook’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example_group.rb:186:in
eval_before_eachs' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example_group.rb:186:ineach’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example_group.rb:186:in
eval_before_eachs' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example.rb:128:inrun_before_each’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example.rb:51:in run' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example.rb:93:incall’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example.rb:93:in with_around_hooks' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example.rb:49:inrun’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example.rb:87:in call' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example.rb:87:inwith_pending_capture’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example.rb:86:in catch' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example.rb:86:inwith_pending_capture’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example.rb:48:in run' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example_group.rb:235:inrun_examples’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example_group.rb:232:in map' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/example_group.rb:232:inrun_examples’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/example_group.rb:216:in run' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/command_line.rb:43:inrun_examples’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/command_line.rb:43:in each' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/command_line.rb:43:ininject’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/command_line.rb:43:in run_examples' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/command_line.rb:26:inrun’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/reporter.rb:11:in report' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/command_line.rb:23:inrun’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/lib/rspec/core/runner.rb:36:in run_in_process' D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec- core-2.0.0.beta.22/lib/rspec/core/runner.rb:27:inrun’
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/bin/rspec:3
D:/ruby/rubies/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-
core-2.0.0.beta.22/bin/rspec:19:in load' D:/ruby/rubies/jruby-1.5.2/bin/rspec:19 D:/ruby/rubies/jruby-1.5.2/bin/rspec:1:inload’
-e:1:

Ok… found the problem… had this line in my spec helper commented
=|

config.fixture_path = “#{::Rails.root}/spec/fixtures”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs