我在这里遇到了一些奇怪的问题。
我有一个“验证器”,它依赖于ND5来哈希我们匹配为密码的某个字符串。当我运行测试时,问题出现了:
我没有收到任何错误、转储或异常。Ruby只是接受它。 为了使这个MD5的东西起作用,我缺少什么?
NoMethodError: undefined method `md5' for #<CASServer::Authenticators::Billing:0x007fd8e6c906a0>
./models/authenticators/billing.rb:63:in `validate'
./routes/login.rb:166:in `block (2 levels) in <class:Server>'
./routes/login.rb:158:in `each'
./routes/login.rb:158:in `block in <class:Server>'
(eval):2:in `click_button'
./features/step_definitions/when_steps.rb:32:in `/^I enter "(.*)" as username and the generated username password and log in$/'
./features/rubycas.login.feature:14:in `When I enter "username" as username and the generated username password and log in'
基本上,他不认为MD5是摘要库的一部分。这个问题发生在IDE中运行测试以及IRB控制台中:
1.9.3-p125 :001 > require "digest/md5" and Digest::MD5("test")
NoMethodError: undefined method `MD5' for Digest:Module
然而,当我运行以下命令时:
[root@DCUDEV01 /home/morn/rubycas/current]# ruby
require "digest/md5" and Digest::MD5("test")
我没有收到任何错误、转储或异常。Ruby只是接受它。 为了使这个MD5的东西起作用,我缺少什么?