fixing functional tests

This commit is contained in:
albert
2011-07-17 16:42:26 -04:00
parent 04ab2f4701
commit 72e9da01b5
26 changed files with 446 additions and 46 deletions

View File

@@ -1,10 +1,6 @@
class UserMaintenanceMailer < ActionMailer::Base
default :from => Danbooru.config.contact_email
def login_reminder(user)
@user = user
mail(:to => user.email, :subject => "#{Danbooru.config.app_name} login reminder")
end
def reset_password(user, new_password)
@user = user

View File

@@ -0,0 +1,30 @@
class UserPasswordResetNonce < ActiveRecord::Base
validates_uniqueness_of :email
validates_presence_of :email, :key
validate :validate_existence_of_email
before_validation :initialize_key, :on => :create
after_create :deliver_notice
def deliver_notice
Maintenance::User::PasswordResetMailer.request(user).deliver
end
def initialize_key
self.key = SecureRandom.hex(16)
end
def validate_existence_of_email
if !User.with_email(email).exists?
errors[:email] << "is invalid"
return false
end
end
def reset_user!
user.reset_password_and_deliver_notice
end
def user
@user ||= User.with_email(email).first
end
end

View File

@@ -82,7 +82,7 @@ class WikiPage < ActiveRecord::Base
end
def post_set
@post_set ||= PostSets::WikiPage.new(title)
@post_set ||= PostSets::Post.new(title)
end
def presenter