daniel-cGcOFQ5lLdklJZD/S0VCNg@public.gmane.org
2006-Oct-30 13:25 UTC
Mocks and Associations
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---