initialize test framenwork and add form handlers for newsletter and contact forms

This commit is contained in:
2012-04-02 18:04:47 +02:00
parent 653275a0f8
commit 2ef63f0517
29 changed files with 993 additions and 55 deletions
+8 -4
View File
@@ -2,12 +2,11 @@ module Cmtool
module Includes
module User
def self.included(klass)
klass.extend Devise::Models
klass.send :include, SimplyStored::Couch
klass.send :include, Devise::Orm::SimplyStored
klass.send :include, InstanceMethods
klass.send :extend, ClassMethods
klass.property :employee_email
klass.property :is_admin, type: :boolean
klass.property :active, type: :boolean, default: true
@@ -36,12 +35,17 @@ module Cmtool
end
def generate_password!
@password_haystack ||= (:a..:z).to_a + (:A..:Z).to_a + (0..9).to_a
@generated_password = @password_haystack.sample(8).join
@generated_password = self.class.password_haystack.sample(8).join
self.password = @generated_password
self.password_confirmation = @generated_password
end
end
module ClassMethods
def password_haystack
@password_haystack ||= (:a..:z).to_a + (:A..:Z).to_a + (0..9).to_a
end
end
end
end
end