From: noreply@... Date: 2007-03-22T04:28:44+09:00 Subject: [ ruby-Bugs-5990 ] Inheritance and Autorunner: Default_test causes a problem Bugs item #5990, was opened at 2006-10-02 10:05 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5990&group_id=426 Category: Standard Library Group: 1.8.5 >Status: Closed Resolution: None Priority: 3 Submitted By: M B (mrbright) Assigned to: Ryan Davis (zenspider) Summary: Inheritance and Autorunner: Default_test causes a problem Initial Comment: I have created an inherited TestCase object. When running the TestSuite with -n /Regexp/ Ruby pukes. The error: f:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:132:in `=~': cannot convert Symbol into String (TypeError) from f:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:134:in `options' from f:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:132:in `[]' from f:/ruby/lib/ruby/1.8/test/unit/collector.rb:26:in `include?' from f:/ruby/lib/ruby/1.8/test/unit/collector.rb:25:in `each' from f:/ruby/lib/ruby/1.8/test/unit/collector.rb:25:in `include?' from f:/ruby/lib/ruby/1.8/test/unit/collector.rb:18:in `add_suite' from f:/ruby/lib/ruby/1.8/test/unit/collector.rb:18:in `find_all' from f:/ruby/lib/ruby/1.8/test/unit/collector.rb:18:in `each' ... 7 levels... from f:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:194:in `run' from f:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:14:in `run' from f:/ruby/lib/ruby/1.8/test/unit.rb:285 from f:/ruby/lib/ruby/1.8/test/unit.rb:283 The actual Code is: autorunner.rb: line 132 Was: @filters << proc{|t| n =~ t.method_name ? true : nil} Changed: @filters << proc{|t| n =~ t.method_name.to_s ? true : nil} When I would run the thing, I found that the default_test method, which I am consequently refusing to run but overwriting my class, it would return a Class type of "Symbol". By putting in the .to_s method call, the system is then able to compensate appropriately. I hope this makes sense. My Inherited class overwrites the Run method with the following: def run(*args) #:nodoc: return if @method_name.to_s == "default_test" super end I do this so that I can exclude the default_test object from my class. Thanks for a great product! ---------------------------------------------------------------------- >Comment By: Ryan Davis (zenspider) Date: 2007-03-21 12:28 Message: the standard way of doing this is a much simpler: undef_method :default_test ---------------------------------------------------------------------- Comment By: M B (mrbright) Date: 2006-11-02 08:04 Message: I am providing a Series of files that will demonstrate what I am talking about. The File: rubyExample.tar.gz - md5sum: c8406ea43910b2483adf7729f62214d6 To demonstrate: ruby trial.rb -n /01/ ---------------------------------------------------------------------- Comment By: Ryan Davis (zenspider) Date: 2006-11-01 22:40 Message: Please provide a minimally reproducible test case. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5990&group_id=426