我正在使用Ruby 1.9.2-p0(尽管在p320上遇到了同样的问题)和Rails 3.1.0.
我对一个相当于this example的控制器进行了一个非常简单的测试.
根据the guide,我需要在使用性能测试之前安装ruby-prof.果然,如果我在没有它的情况下运行我的性能测试,我得到:
Specify ruby-prof as application’s dependency in Gemfile to run benchmarks.
如果我按照指南的说明进行操作,我将其添加到我的Gemfile中:
gem ‘ruby-prof’,:git => ‘git://github.com/wycats/ruby-prof.git’
…从wycats存储库获取版本0.11.0.当我运行我的测试时,我收到此错误:
/Users/craig/.rvm/gems/ruby-1.9.2-p0/bundler/gems/ruby-prof-ffae61a89553/lib/ruby-prof/abstract_printer.rb:44:in `inspect': undefined method `to_s' for #<Class:0x000001025a3f18> (NoMethodError) from /Users/craig/.rvm/gems/ruby-1.9.2-p0/bundler/gems/ruby-prof-ffae61a89553/lib/ruby-prof/abstract_printer.rb:44:in `full_name' ...
但是,“wycats”似乎并不是ruby-prof的规范Github回购.文档参考rdp(Roger Pack).如果我改用这个回购:
gem ‘ruby-prof’,:git => ‘git://github.com/rdp/ruby-prof.git’
…我得到版本0.11.2,并得到此错误:
/Users/craig/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.1.0/lib/active_support/testing/performance/ruby.rb:39:in
run': undefined method
values’ for [#]:Array (NoMethodError)
from /Users/craig/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.1.0/lib/active_support/testing/performance.rb:140:in `run_profile’
…
如果我直接使用来自rubygems的gem(同样,版本0.11.2),我会得到同样的错误:
gem ‘ruby-prof’
任何想法出了什么问题,或者如何解决?