diff --git a/spec/features/issuables/system_notes_spec.rb b/spec/features/issuables/system_notes_spec.rb deleted file mode 100644 index e12d81e76cb..00000000000 --- a/spec/features/issuables/system_notes_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -describe 'issuable system notes', feature: true do - let(:issue) { create(:issue, project: project, author: user) } - let(:merge_request) { create(:merge_request, :simple, source_project: project) } - let(:project) { create(:project, :public) } - let(:user) { create(:user) } - - before do - project.add_user(user, :master) - login_as(user) - end - - [:issue, :merge_request].each do |issuable_type| - context "when #{issuable_type}" do - before do - issuable = issuable_type == :issue ? issue : merge_request - - visit(edit_polymorphic_path([project.namespace.becomes(Namespace), project, issuable])) - end - - it 'adds system note "description changed"' do - fill_in("#{issuable_type}_description", with: 'hello world') - click_button('Save changes') - - expect(page).to have_content("#{user.name} #{user.to_reference} changed the description") - end - end - end -end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 93b7880b96f..81cc8513454 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -714,26 +714,4 @@ describe 'Issues', feature: true do expect(page).to have_text("updated title") end end - - describe '"edited by" message', js: true do - let(:issue) { create(:issue, project: project, author: @user) } - - context 'when issue is updated' do - before { visit edit_namespace_project_issue_path(project.namespace, project, issue) } - - it 'shows "edited by" mesage on title update' do - fill_in 'issue_title', with: 'hello world' - click_button 'Save changes' - - expect(page).to have_content("Edited less than a minute ago by #{@user.name}") - end - - it 'shows "edited by" mesage on description update' do - fill_in 'issue_description', with: 'hello world' - click_button 'Save changes' - - expect(page).to have_content("Edited less than a minute ago by #{@user.name}") - end - end - end end diff --git a/spec/features/merge_requests/edit_mr_spec.rb b/spec/features/merge_requests/edit_mr_spec.rb index b0855af9524..cb3bc392903 100644 --- a/spec/features/merge_requests/edit_mr_spec.rb +++ b/spec/features/merge_requests/edit_mr_spec.rb @@ -67,23 +67,5 @@ feature 'Edit Merge Request', feature: true do def get_textarea_height page.evaluate_script('document.getElementById("merge_request_description").offsetHeight') end - - describe '"edited by" message', js: true do - context 'when merge request is updated' do - it 'shows "edited by" mesage on title update' do - fill_in 'merge_request_title', with: 'hello world' - click_button 'Save changes' - - expect(page).to have_content("Edited less than a minute ago by #{user.name}") - end - - it 'shows "edited by" mesage on description update' do - fill_in 'merge_request_description', with: 'hello world' - click_button 'Save changes' - - expect(page).to have_content("Edited less than a minute ago by #{user.name}") - end - end - end end end diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 5b324f3c706..ee01b3871f3 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -132,6 +132,17 @@ describe Issues::UpdateService, services: true do end end + context 'when description changed' do + it 'creates system note about description change' do + update_issue(description: 'Changed description') + + note = find_note('changed the description') + + expect(note).not_to be_nil + expect(note.note).to eq('changed the description') + end + end + context 'when issue turns confidential' do let(:opts) do { diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index f2ca1e6fcbd..98fc41f2ac0 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -102,6 +102,13 @@ describe MergeRequests::UpdateService, services: true do expect(note.note).to eq 'changed title from **{-Old-} title** to **{+New+} title**' end + it 'creates system note about description change' do + note = find_note('changed the description') + + expect(note).not_to be_nil + expect(note.note).to eq('changed the description') + end + it 'creates system note about branch change' do note = find_note('changed target') diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index 5e85c3c1621..5775874ebe0 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -301,7 +301,7 @@ describe SystemNoteService, services: true do end it 'sets the note text' do - expect(subject.note).to eq 'changed the description' + expect(subject.note).to eq('changed the description') end end end