gpt4 book ai didi

ruby-on-rails - 参数错误 : wrong # of arguments(0 for 1) Rails Unit Testing

转载 作者:太空宇宙 更新时间:2023-11-03 16:57:29 26 4
gpt4 key购买 nike

错误显示“ArgumentError:错误的参数数量(0 代表 1)”:

def test_auth
#check that we can login we a valid Usuario
assert_equal @bob, Usuario.autenticar("bob", "test")
end

但是,autenticar 确实有两个参数:

def self.autenticar(usuario, clave)
u=find(:first, :conditions=>["usuario = ?", usuario])
return nil if u.nil?
return u if Usuario.encrypt(clave, u.salt)==u.clave
nil
end

发生了什么事?

最佳答案

如评论部分所述,autenticar 中的方法 clave 需要一个参数,但没有得到。

关于ruby-on-rails - 参数错误 : wrong # of arguments(0 for 1) Rails Unit Testing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6331662/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com