summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-05 09:29:03 +0200
committerToon Claes <toon@gitlab.com>2017-05-08 08:48:38 +0200
commit3531ea096f730b8533df259ac2f6cbed738965ed (patch)
treed484c6e4a6af89282bf9e70fae235ed5fb0f13a5 /spec/models
parent6a915d6f2d462a376d8cecc062dd58e520339b5e (diff)
downloadgitlab-ce-3531ea096f730b8533df259ac2f6cbed738965ed.tar.gz
Devise can assign trackable fields, but only allow writes once/hourtc-cache-trackable-attributes
Not assigning the trackable fields seems to cause strange side-effects.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/user_spec.rb12
1 files changed, 11 insertions, 1 deletions
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