Hi List,
I am doing some testing which involves an authentication method on my
user controller. In production it actually uses PAM (on my linux system
to an external LDAP server) to authenticate users but this is
impractical for my testing. To get to the point I have:
require ‘pam’
class User < ActiveRecord::Base
has_many :blah
def authenticate(password)
# some pam voodoo here
end
end
In my test/mocks/test directory I have:
require ‘models/user’
class User < ActiveRecord::Base
def authenticate(pass)
pass == Digest::MD5.hexdigest(self.password)
end
end
However, whenever I run this test my associations fail. Does anyone
have any suggestions?
Regards,
Daniel