diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-28 08:25:43 +0200 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-29 17:20:11 +0200 |
commit | a74a6cfddf1a6455e7ade0fd40e4053bb30f7f1e (patch) | |
tree | bad411906ad1267dabecf2447b9d139b6e4a9ab0 /spec/services/notes/update_service_spec.rb | |
parent | 76a15db45f4911542241ae62fe871101f1f79a78 (diff) | |
download | gitlab-ce-a74a6cfddf1a6455e7ade0fd40e4053bb30f7f1e.tar.gz |
Create todos only for new mentions
Diffstat (limited to 'spec/services/notes/update_service_spec.rb')
-rw-r--r-- | spec/services/notes/update_service_spec.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/services/notes/update_service_spec.rb b/spec/services/notes/update_service_spec.rb index dde4bde7dc2..905e2f46bde 100644 --- a/spec/services/notes/update_service_spec.rb +++ b/spec/services/notes/update_service_spec.rb @@ -4,12 +4,14 @@ describe Notes::UpdateService, services: true do let(:project) { create(:empty_project) } let(:user) { create(:user) } let(:user2) { create(:user) } + let(:user3) { create(:user) } let(:issue) { create(:issue, project: project) } - let(:note) { create(:note, project: project, noteable: issue, author: user, note: 'Old note') } + let(:note) { create(:note, project: project, noteable: issue, author: user, note: "Old note #{user2.to_reference}") } before do project.team << [user, :master] project.team << [user2, :developer] + project.team << [user3, :developer] end describe '#execute' do @@ -23,22 +25,30 @@ describe Notes::UpdateService, services: true do context 'when the note change' do before do - update_note({ note: 'New note' }) + update_note({ note: "New note #{user2.to_reference} #{user3.to_reference}" }) end it 'marks todos as done' do expect(todo.reload).to be_done end + + it 'creates only 1 new todo' do + expect(Todo.count).to eq(2) + end end context 'when the note does not change' do before do - update_note({ note: 'Old note' }) + update_note({ note: "Old note #{user2.to_reference}" }) end it 'keep todos' do expect(todo.reload).to be_pending end + + it 'does not create any new todos' do + expect(Todo.count).to eq(1) + end end end end |