diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-23 12:41:53 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-23 13:22:27 +0100 |
commit | bab50e0133e226c06b7a968c2bfa46717de81485 (patch) | |
tree | 3b96ef986689b8844d05039f86972aec3752ed0b /spec/services/issues/move_service_spec.rb | |
parent | 703f7c5d579a6ab6d7592c24f8e3f2813d9d1703 (diff) | |
download | gitlab-ce-bab50e0133e226c06b7a968c2bfa46717de81485.tar.gz |
Preserve time notes has been updated at when moving issue
Diffstat (limited to 'spec/services/issues/move_service_spec.rb')
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index ade3b7850f1..9b0c73aaf37 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -85,6 +85,10 @@ describe Issues::MoveService, services: true do expect(old_issue.moved?).to eq true expect(old_issue.moved_to).to eq new_issue end + + it 'preserves create time' do + expect(old_issue.created_at).to eq new_issue.created_at + end end context 'issue with notes' do @@ -121,10 +125,23 @@ describe Issues::MoveService, services: true do it 'preserves orignal author of comment' do expect(user_notes.pluck(:author_id)).to all(eq(author.id)) end + end + + context 'note that has been updated' do + let!(:note) do + create(:note, noteable: old_issue, project: old_project, + author: author, updated_at: Date.yesterday, + created_at: Date.yesterday) + end + + include_context 'issue move executed' it 'preserves time when note has been created at' do - expect(old_issue.notes.first.created_at) - .to eq new_issue.notes.first.created_at + expect(new_issue.notes.first.created_at).to eq note.created_at + end + + it 'preserves time when note has been updated at' do + expect(new_issue.notes.first.updated_at).to eq note.updated_at end end |