开发者

Unable to find matching line from backtrace RSPEC with rails 3.0.10

I've updated to 3.0.10 because of the sql开发者_如何学编程 injection vulnerability. After I updated, I ran the tests and all of them started throwing the above error along with the following lines.

Failure/Error: Unable to find matching line from backtrace
SystemStackError:
  stack level too deep
# /home/part/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:153


I had experienced a similar error while running Cucumber features when upgrading my project from Rails 2.3.8 to 3.2.2. There's almost no way that I know you can find out the stack trace of this error.

The real problem, in my case, was double inclusion of a library, called rest-client, once as a plugin, and once as a gem. It was in my Gemfile, as well as in my vendor/plugins directory. Maybe you can make a quick check if there's anything like that with your project.

I found this out by a tedious process of using 'raise' at several places of my code. In your execution path of the rspec statement that causes this error, put raise method calls at different places, e.g.

raise StandardError, 'code did reach here'

That, with some binary search logic, will get you close to the culprit code. Once you're there, use the following construct to get a stack trace.

begin
  # culprit code is here
rescue Exception => e
  puts e.message
  puts e.backtrace.inspect
end

That worked for me at least, hope it helps you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜