Closed thegengen closed 13 years ago
And what do you see with a different require
?
require 'rubygems'
require 'test/unit'
require 'wrong/adapters/test_unit'
class WrongTest < Test::Unit::TestCase
def test_something
assert { false }
end
end
Something like
1 tests, 0 assertions, 1 failures, 0 errors
?
~/src/ruby/wrong (master)$ ruby --version
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0]
wrong => 0.5.1
?, Thierry
Hi.
I was using wrong 0.5.0. The version you're using seems not to have propagated to rubygems.org yet. I cloned your repo and installed 0.5.1 by hand, and the issue (as I reported it) still exists.
After changing the require, I do indeed get a failure, just like in your output.
Oh, and my ruby version:
test [ree-1.8.7] :) ruby --version
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.1], MBARI 0x6770, Ruby Enterprise Edition 2011.03
I'll investigate this further myself.
Thanks, Eugen.
the wrong assert {}
raises a default Wrong::Error::AssertionFailedError
there is no chance that a test lib understand it as 'failure += 1'
You have to pick the correct adapter for a test lib
Have a look in README : #Adapters WDYT?
I see, that makes sense.
As for my thoughts, I guess it depends how far you want to go. In theory, require 'wrong' could test for things like
Object.const_defined? :RSpec
etc. and figure out which adapter(s) to load on the fly. You could obtain the current functionality with something like
require 'wrong/base'
If not, I think the documentation should be changed a bit. It should be clear from the #Usage section in the README that you'll probably want to require one of these adapters. I imagine most people just want to hook it into whatever they're using. Not loading any adapters and using wrong solo (as a kind of micro-framework if I understand it correctly) seems to me like only one of the various usage scenarios.
Let me know what you think, maybe I can help you guys out with a patch.
The README already says:
Adapters for various test frameworks sit under wrong/adapters.
Currently we support
require 'wrong/adapters/test_unit'
require 'wrong/adapters/minitest'
require 'wrong/adapters/rspec'
(now supports both 1.3 and 2.0)To use these, put the appropriate require
in your helper, after requiring your test framework; it should extend the framework enough that you can use assert { }
in your test cases without extra fussing around.
Perhaps we should move that section higher up.
BTW I'm OK with autoloading the adapter based on const_defined like minciue suggests.
README updated
Hi again.
Using Ruby 1.8.7 and test/unit running this file:
Gives me this output:
Thank you.