自动测试上的 rspec 堆栈跟踪
我刚刚进入自动测试,遇到以下问题。
如何进行自动测试以打印错误的堆栈跟踪。 如果我运行“rake spec”,我会得到输出
4) Transaction should get date with poor form
Failure/Error: transaction = Transaction.build_from_email(@email)
NoMethodError:
private method `gsub' called for 112:Fixnum
# ./app/models/transaction.rb:46:in `build_from_email'
# ./spec/models/transaction_spec.rb:104
,但我会通过自动测试得到以下结果
4) Transaction should get date with poor form
Failure/Error: transaction = Transaction.build_from_email(@email)
NoMethodError:
private method `gsub' called for 112:Fixnum
,这样会更容易找到错误所在。
非常感谢
I'm just getting into autotest and i have the following problem.
How do I get autotest to print stack traces on errors.
If i run "rake spec" i get output
4) Transaction should get date with poor form
Failure/Error: transaction = Transaction.build_from_email(@email)
NoMethodError:
private method `gsub' called for 112:Fixnum
# ./app/models/transaction.rb:46:in `build_from_email'
# ./spec/models/transaction_spec.rb:104
but i get the following with autotest
4) Transaction should get date with poor form
Failure/Error: transaction = Transaction.build_from_email(@email)
NoMethodError:
private method `gsub' called for 112:Fixnum
Would just be alot easier to find where the error is.
Thanks a bunch
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是 RSpec 2,您可以在项目根目录中添加一个名为
.rspec
的文件,其中包含以下内容:RSpec 在运行时将读取此文件,无论是通过 Rake 还是 Autotest。
If you're using RSpec 2 you can add a file called
.rspec
in the project root with this content:RSpec will read this file when it's run, whether it's through Rake or Autotest.