test/models/trackable_test.rb in devise-4.3.0 vs test/models/trackable_test.rb in devise-4.4.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'test_helper'
class TrackableTest < ActiveSupport::TestCase
test 'required_fields should contain the fields that Devise uses' do
assert_equal Devise::Models::Trackable.required_fields(User), [
@@ -35,7 +37,16 @@
assert_nil user.current_sign_in_ip
assert_nil user.last_sign_in_ip
assert_nil user.current_sign_in_at
assert_nil user.last_sign_in_at
assert_equal 0, user.sign_in_count
+ end
+
+ test 'update_tracked_fields should run model validations' do
+ user = UserWithValidations.new
+ request = mock
+ request.stubs(:remote_ip).returns("127.0.0.1")
+
+ assert_not user.update_tracked_fields!(request)
+ assert_not user.persisted?
end
end