Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors with ruby-prof in a Rails Performance Test
    text
    copied!<p>I'm creating a Rails Performance test, as described in the <a href="http://guides.rubyonrails.org/performance_testing.html#installing-gc-patched-mri" rel="noreferrer">Rails Guide</a>, and I'm having problems with ruby-prof.</p> <p>I'm using Ruby 1.9.2-p0 (though experienced the same issue on p320) and Rails 3.1.0.</p> <p>I have a pretty simple test for a controller that is equivalent to <a href="http://guides.rubyonrails.org/performance_testing.html#controller-example" rel="noreferrer">this example</a>.</p> <p>According to <a href="http://guides.rubyonrails.org/performance_testing.html#using-ruby-prof-on-mri-and-ree" rel="noreferrer">the guide</a>, I need to install ruby-prof before I can use performance tests. Sure enough, if I run my performance test without it, I get:</p> <blockquote> <p>Specify ruby-prof as application's dependency in Gemfile to run benchmarks.</p> </blockquote> <p>If I follow the guide's instructions to the letter, I add this to my Gemfile:</p> <blockquote> <p>gem 'ruby-prof', :git => 'git://github.com/wycats/ruby-prof.git'</p> </blockquote> <p>...and get version 0.11.0 from the wycats repository. When I run my test I get this error:</p> <pre><code>/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 #&lt;Class:0x000001025a3f18&gt; (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' ... </code></pre> <p>But "wycats" doesn't appear to be the canonical Github repo for ruby-prof. The documentation refers to <a href="https://github.com/rdp/ruby-prof" rel="noreferrer">rdp</a> (Roger Pack). If I use that repo instead:</p> <blockquote> <p>gem 'ruby-prof', :git => 'git://github.com/rdp/ruby-prof.git'</p> </blockquote> <p>...I get version 0.11.2, and get this error:</p> <blockquote> <p>/Users/craig/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.1.0/lib/active_support/testing/performance/ruby.rb:39:in <code>run': undefined method</code>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' ...</p> </blockquote> <p>I get the same error if I just use the gem from rubygems directly (again, version 0.11.2): </p> <blockquote> <p>gem 'ruby-prof'</p> </blockquote> <p>Any ideas what's going wrong, or how to resolve it?</p> <blockquote> <p></p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload