mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-06 03:01:21 -04:00
Initial Datamapper test suite
Test suite runs, however there's still some failing tests. This allows us to at least have a working test suite so they can fix these datamapper spec failures individually.
This commit is contained in:
@@ -38,18 +38,22 @@ module Devise
|
||||
module ClassMethods
|
||||
# Hooks for confirmable
|
||||
def before_create(*args)
|
||||
wrap_hook(:before, *args)
|
||||
wrap_hook(:before, :create, *args)
|
||||
end
|
||||
|
||||
def after_create(*args)
|
||||
wrap_hook(:after, *args)
|
||||
wrap_hook(:after, :create, *args)
|
||||
end
|
||||
|
||||
def before_save(*args)
|
||||
wrap_hook(:before, :save, *args)
|
||||
end
|
||||
|
||||
def wrap_hook(action, *args)
|
||||
def wrap_hook(action, method, *args)
|
||||
options = args.extract_options!
|
||||
|
||||
args.each do |callback|
|
||||
send action, :create, callback
|
||||
send action, method, callback
|
||||
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
||||
def #{callback}
|
||||
super if #{options[:if] || true}
|
||||
@@ -68,10 +72,14 @@ module Devise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def changed?
|
||||
dirty?
|
||||
end
|
||||
|
||||
def save(options=nil)
|
||||
if options.is_a?(Hash) && options[:validate] == false
|
||||
save!
|
||||
save
|
||||
else
|
||||
super()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user