ArgumentError: wrong # of arguments(0 for 1) Rails Unit Testing
the error says "ArgumentError: wrong # of arguments(0 for 1)" for:
def test_auth
#check that we can login we a valid Usuario
assert_equal @bob, Usuario.autenticar("bob", "test")
end
But, autenticar DOES take 2 arguments:
def self.autenticar(usuario, clave)
u=find(:firs开发者_如何学Got, :conditions=>["usuario = ?", usuario])
return nil if u.nil?
return u if Usuario.encrypt(clave, u.salt)==u.clave
nil
end
Whats happening?
As noted in the comments section, the method clave
within autenticar
expected an argument and didn't get one.
精彩评论