test/rails_app/app/data_mapper/user.rb in dm-devise-1.5.0.beta vs test/rails_app/app/data_mapper/user.rb in dm-devise-1.5.0
- old
+ new
@@ -7,10 +7,17 @@
property :username, String
property :facebook_token, String
property :confirmation_token, String, :writer => :private
timestamps :at
+ class << self
+ # attr_accessible is used by SharedUser. Instead of trying to make a
+ # a compatibility method, ignore it and set writer option to private on
+ # confirmation_token property.
+ def attr_accessible(*args); nil; end
+ end
+
include SharedUser
include Shim
if VALIDATION_LIB == 'dm-validations'
before :valid?, :update_password_confirmation
@@ -23,6 +30,13 @@
if self.password && self.password_confirmation.nil?
self.password_confirmation = self.password
end
end
end
+end
+
+# Define UserWithValidation here (instead of waiting for definition in
+# devise/test/models_test.rb) to ensure it is finalized. Otherwise,
+# DatabaseAuthenticatableTest 'should run validations even when current password is invalid or blank' fails.
+class UserWithValidation < User
+ validates_presence_of :username
end