seattlerb / zentest

144 stars 72 forks source link

zentest doesn't seem to do anything #14

Closed thobruk closed 12 years ago

thobruk commented 12 years ago

I have a file that contains a class definition, when I run:

zentest models/myclass.rb

It looks very much like the same output as if I run

ruby -w models/myclass.rb

and no tests are generated. The file also seems to be executed rather than inspected. What up with that ?

zenspider commented 12 years ago

Since I don't know what's in your file, I could only guess...

I get plenty of output when I run it:


% ruby -Ilib bin/zentest lib/autotest.rb 
# Code Generated by ZenTest v. 4.6.2
#                 classname: asrt / meth =  ratio%
#                  Autotest:    0 /   41 =   0.00%

require 'test/unit/testcase'
require 'test/unit' if $0 == __FILE__

class TestAutotest < Test::Unit::TestCase
  def test_class_add_discovery
    raise NotImplementedError, 'Need to write test_class_add_discovery'
  end

  def test_class_add_hook
    raise NotImplementedError, 'Need to write test_class_add_hook'
  end

  def test_class_autodiscover
    raise NotImplementedError, 'Need to write test_class_autodiscover'
  end

  def test_class_options
    raise NotImplementedError, 'Need to write test_class_options'
  end

  # ...76 more...
end

# Number of errors detected: 80

As far as running it goes, yup... that's how it discovers new classes and methods that might need testing.

thobruk commented 12 years ago

my test file looks like this:

class ExampleClass def some_function puts'yay!' end end

when i run 'zentest example_class.rb' literally nothing happens

thobruk commented 12 years ago

Update. When I invoke it specifically like this:

ruby /home/whatever/.rvm/gems/ruby-1.9.2-p290/bin/zentest ./example_class.rb

it works. is there an incompatibility with rvm or something ?

thobruk commented 12 years ago

Update. The first line of the zentest file is:

!/home/bthomas/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -swI

This appears to the problem. The 'I' switch is screwing everything up. I'm not sure what generates that line.

zenspider commented 12 years ago

On Feb 16, 2012, at 15:48 , thobruk wrote:

Update. The first line of the zentest file is:

!/home/bthomas/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -swI

This appears to the problem. The 'I' switch is screwing everything up. I'm not sure what generates that line.

The original file has:

#!/usr/bin/env ruby -swI .

So... yeah. Someone removed the . and that's bad, but it isn't a problem with zentest.

zenspider commented 12 years ago

fixed in rubygems.

thobruk commented 12 years ago

It's working great for me now I changed the file. Thanks for a great tool for testing ! Slightly addictive...