How to monkeypatch in a plugin

Hi all,

I’m working on a plugin that enables automatic profiling and
benchmarking for unit tests. I need to monkeypatch
Test::Unit::TestSuite to redefine the run method. Based on the example
I see at http://svn.jthopple.com/plugins/count_limit_associations, I
thought I should be able to simply open the class in question in
/lib/profile_tests.rb, e.g.

module Test
module Unit
class Suite
def run
puts “My Run Method Used”

In init.rb, I simply have

require ‘profile_tests’

However, running my tests does not seem to use my definition of ‘run’.
Am I missing something?

Thanks!

Brian

Brian H. wrote:

[…]
However, running my tests does not seem to use my definition of ‘run’.
Am I missing something?

Thanks!

Brian

Ah, heck. ‘Suite’ should be ‘TestSuite’. Sorry for the noise. :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs