开发者

Where's the rest of the stacktrace?

I have a test that is raising an error. To track down the problem I end开发者_开发知识库ed up adding this method to a model called NodeAffiliation:

def initialize a1, a2
  raise "kaboom"
end

and then I get this error:

RuntimeError: kaboom
app/models/node_affiliation.rb:13:in `initialize'
    test/unit/audit_test.rb:10:in `__bind_1318003437_24401'

but audit_test.rb is doing this:

Factory.create :form

Somehow, creating a Form also creates a NodeAffiliation, but those steps seem to be missing in the backtrace. Any ideas why and/or how to get them?


The test logs might already have the stacktrace, but if not you can call

logger.debug $!.backtrace.join("\n")

where $! is the default name of the exception that was raised. This needs to be in a rescue block. I would check your factory implementation, it is likely associating node_affiliation with form objects, or perhaps there is a chain of relations. Any associations declared in the factory get created when the object is created.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜