diff options
author | Stan Hu <stanhu@gmail.com> | 2018-03-06 00:37:37 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-03-06 00:38:46 +0300 |
commit | 2d1ceca077a1624a4bdc6aa26ab8a5113a5f6394 (patch) | |
tree | e21b0fcb85052959a673114b0691f5f7233854fc /spec/services/system_hooks_service_spec.rb | |
parent | 8a0052c037f025b64159ca8cfe0d3451261c1edb (diff) |
Don't error out in system hook if user has `nil` datetime columns
Deleting a user would fail in the system hooks if the user had
`nil` column in `datetime` or `updated_at` fields.
Closes #43871
Diffstat (limited to 'spec/services/system_hooks_service_spec.rb')
-rw-r--r-- | spec/services/system_hooks_service_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb index c40cd5b7548..a538d0c109a 100644 --- a/spec/services/system_hooks_service_spec.rb +++ b/spec/services/system_hooks_service_spec.rb @@ -70,6 +70,14 @@ describe SystemHooksService do expect(data[:project_visibility]).to eq('private') end + it 'handles nil datetime columns' do + user.update_attributes(created_at: nil, updated_at: nil) + data = event_data(user, :destroy) + + expect(data[:created_at]).to be(nil) + expect(data[:updated_at]).to be(nil) + end + context 'group_rename' do it 'contains old and new path' do allow(group).to receive(:path_was).and_return('old-path') |