summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-05 22:00:36 +0100
committerSean McGivern <sean@gitlab.com>2017-05-05 22:00:36 +0100
commit86e75ae09238c7f73347c0e310c47f6070c005b9 (patch)
treee2ce5edb596eb8b35cf530669f34bf1cb034b05a /spec
parentc1d5af67d3743b12718939c9d60c38035d388176 (diff)
parent8c4c40d09b6947f4ac652dd76cc422fea2a6443d (diff)
downloadgitlab-ce-86e75ae09238c7f73347c0e310c47f6070c005b9.tar.gz
Merge branch 'blackst0ne/gitlab-ce-add_system_note_for_editing_issuable'
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml3
-rw-r--r--spec/lib/gitlab/import_export/safe_model_attributes.yml4
-rw-r--r--spec/services/issues/update_service_spec.rb11
-rw-r--r--spec/services/merge_requests/update_service_spec.rb7
-rw-r--r--spec/services/system_note_service_spec.rb14
5 files changed, 39 insertions, 0 deletions
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index cd2fa27bb9f..f7654f1aade 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -9,6 +9,7 @@ issues:
- notes
- label_links
- labels
+- last_edited_by
- todos
- user_agent_detail
- moved_to
@@ -27,6 +28,7 @@ notes:
- noteable
- author
- updated_by
+- last_edited_by
- resolved_by
- todos
- events
@@ -72,6 +74,7 @@ merge_requests:
- notes
- label_links
- labels
+- last_edited_by
- todos
- target_project
- source_project
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index 59c8b48a2be..a66086f8b47 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -23,6 +23,8 @@ Issue:
- weight
- time_estimate
- relative_position
+- last_edited_at
+- last_edited_by_id
Event:
- id
- target_type
@@ -154,6 +156,8 @@ MergeRequest:
- approvals_before_merge
- rebase_commit_sha
- time_estimate
+- last_edited_at
+- last_edited_by_id
MergeRequestDiff:
- id
- state
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index 6633ac10236..1954d8739f6 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 694ec3a579f..31487c0f794 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 68816bf36b8..516566eddef 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -339,6 +339,20 @@ describe SystemNoteService, services: true do
end
end
+ describe '.change_description' do
+ subject { described_class.change_description(noteable, project, author) }
+
+ context 'when noteable responds to `description`' do
+ it_behaves_like 'a system note' do
+ let(:action) { 'description' }
+ end
+
+ it 'sets the note text' do
+ expect(subject.note).to eq('changed the description')
+ end
+ end
+ end
+
describe '.change_issue_confidentiality' do
subject { described_class.change_issue_confidentiality(noteable, project, author) }