Se_Ed
(Se Ed)
1
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
···
--
Posted via http://www.ruby-forum.com/.
Se_Ed
(Se Ed)
2
I'm now reading that I have to be using ActiveRecord to use test-unit?
Is that correct?
···
--
Posted via http://www.ruby-forum.com/.
You should be creating a subclass of Test::Unit::TestCase in your file and defining tests within that.
# in a file named my_test.rb (just convention, call it fred.rb if you 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
Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
···
On Jan 22, 2010, at 1:46 PM, 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
test
Sorry for such a simple question
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
···
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
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
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.
Best,
···
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/\.