From 3531ea096f730b8533df259ac2f6cbed738965ed Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 5 May 2017 09:29:03 +0200 Subject: Devise can assign trackable fields, but only allow writes once/hour Not assigning the trackable fields seems to cause strange side-effects. --- spec/models/user_spec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'spec/models') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0b59916342e..c7ddd17872b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -359,7 +359,17 @@ describe User, models: true do expect do user.update_tracked_fields!(request) - end.not_to change { user.current_sign_in_at } + end.not_to change { user.reload.current_sign_in_at } + end + + it 'writes trackable attributes for a different user' do + user2 = create(:user) + + user.update_tracked_fields!(request) + + expect do + user2.update_tracked_fields!(request) + end.to change { user2.reload.current_sign_in_at } end end -- cgit v1.2.1