NoMethodError: undefined method while running test

I run the command: ruby test/unit/user_test.rb

I get the error: NoMethodError: undefined method `authenticate' for #<Class:0x193dd20>     C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/base .rb:1959:in `method_missing'     test/unit/user_test.rb:13:in `test_auth' The authenticate method is defined in

This is denition of authenticate method in modes/user.rb class UserTest < ActiveSupport::TestCase   # Replace this with your real tests.   # test "the truth" do   # assert true   self.use_instantiated_fixtures = true   fixtures :users def self.authenticate(login, pass)   u=find(:first, :conditions=>["login = ?", login])   return nil if u.nil?   return u if User.encrypt(pass, u.salt)==u.hashed_password   nil end

This is where it is called from user_test.rb def test_auth   assert_equal @bob, User.authenticate("rao", "test") end

username rao is already defined in users.yml

Can someone please tell me how to fix this?

Sorry, there was a mistake in my posting. The correction to user_test.rb def test_auth    assert_equal @rao, User.authenticate("rao", "test") end where user rao has been defined in users.yml

I get this error NoMethodError: undefined method `authenticate' When the method 'authenticate' is already defined. Why is it unable to find the method?

Vishwa Rao wrote:

I run the command: ruby test/unit/user_test.rb

I get the error: NoMethodError: undefined method `authenticate' for #<Class:0x193dd20> C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/base .rb:1959:in `method_missing' test/unit/user_test.rb:13:in `test_auth' The authenticate method is defined in

This is denition of authenticate method in modes/user.rb class UserTest < ActiveSupport::TestCase # Replace this with your real tests. # test "the truth" do # assert true self.use_instantiated_fixtures = true fixtures :users def self.authenticate(login, pass)

You have this inside class UserTest instead of User

Colin