I am having a problem with using the test-unit gem
I get a NoMethodError when I simply do
require ‘test/unit/assertions’
#I’ve also used just require ‘test/unit’
def test
assert_equal(true, true)
end
test
Sorry for such a simple question
I am having a problem with using the test-unit gem
I get a NoMethodError when I simply do
require ‘test/unit/assertions’
#I’ve also used just require ‘test/unit’
def test
assert_equal(true, true)
end
test
Sorry for such a simple question
I’m now reading that I have to be using ActiveRecord to use test-unit?
Is that correct?
Se Ed wrote:
I’m now reading that I have to be using ActiveRecord to use test-unit?
Is that correct?
I don’t think it is correct…but you probably want to be using RSpec
anyway. It’s a much friendlier test framework.
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
On Jan 22, 2010, at 1:46 PM, Se Ed wrote:
test
Sorry for such a simple question
You should be creating a subclass of Test::Unit::TestCase in your file
and defining tests within that.
like)
require ‘test/unit’
class MyTest < Test::Unit::TestCase
def test_starting_simple
assert_equal(true, true)
end
end
END
Then run that file with “ruby ./my_test.rb” to get:
$ ruby ./my_test.rb
Loaded suite ./my_test
Started
.
Finished in 0.000476 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
That should get you going.
-Rob
At 2010-01-22 01:46PM, “Se Ed” wrote:
I am having a problem with using the test-unit gem
I get a NoMethodError when I simply do
require ‘test/unit/assertions’
#I’ve also used just require ‘test/unit’def test
assert_equal(true, true)
end
The Test::Unit::Assertions module defines instance methods, so you have
to mix that module in to some object or class.
You can do this:
include Test::Unit::Assertions
def test
assert_equal(true, true)
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs