diff options
author | Sean McGivern <sean@gitlab.com> | 2019-05-06 20:24:23 +0000 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-05-06 20:24:23 +0000 |
commit | 835c616b12a8712634f5ddbfd8a5e70673a1a663 (patch) | |
tree | a5ac03e27de2d0c92060bc7c6f40b9dae8c0802f /spec/models | |
parent | 1309e180fad744658ed8de9d912fb4eaf9998be8 (diff) | |
download | gitlab-ce-835c616b12a8712634f5ddbfd8a5e70673a1a663.tar.gz |
Fix editing issues and MRs with NULL lock_version
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/issue_spec.rb | 12 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 0cd69cb4817..0ce4add5669 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -55,6 +55,18 @@ describe Issue do end end + describe 'locking' do + it 'works when an issue has a NULL lock_version' do + issue = create(:issue) + + described_class.where(id: issue.id).update_all('lock_version = NULL') + + issue.update!(lock_version: 0, title: 'locking test') + + expect(issue.reload.title).to eq('locking test') + end + end + describe '#order_by_position_and_priority' do let(:project) { create :project } let(:p1) { create(:label, title: 'P1', project: project, priority: 1) } diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 7457efef013..ec2aef6f815 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -31,6 +31,18 @@ describe MergeRequest do end end + describe 'locking' do + it 'works when a merge request has a NULL lock_version' do + merge_request = create(:merge_request) + + described_class.where(id: merge_request.id).update_all('lock_version = NULL') + + merge_request.update!(lock_version: 0, title: 'locking test') + + expect(merge_request.reload.title).to eq('locking test') + end + end + describe '#squash_in_progress?' do let(:repo_path) do Gitlab::GitalyClient::StorageSettings.allow_disk_access do |