2010/1/25 Vishwa Rao <li...@ruby-forum.com>:
> 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

>  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?
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to