newbie help

S

Se Ed

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
 
S

Se Ed

I'm now reading that I have to be using ActiveRecord to use test-unit?
Is that correct?
 
M

Marnen Laibow-Koser

Se said:
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,
 
R

Rob Biedenharn

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,250
Latest member
Charlesreero

Latest Threads

Top