I'm running into something weird here. I have an "authenticator" that relies on ND5 to hash a certain string we match as password. The problem when I run my tests is this:
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'
So basically he does not recognize the MD5 as part of the Digest library. This problem occurs when running the tests in the IDE, as well as in the IRB console:
1.9.3-p125 :001 > require "digest/md5" and Digest::MD5("test")
NoMethodError: undefined method `MD5' for Digest:Module
However, when I run the following:
[root@DCUDEV01 /home/morn/rubycas/current]# ruby
require "digest/md5" and Digest::MD5("test")
I receive no errors, dumps or exceptions. Ruby just accepts it. What am I missing in order to get this MD5 stuff working?
Digest::MD5 is not a method but a module. Try
Digest::MD5.digest("test")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With