Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlex Moore-Niemi <moore.niemi@gmail.com>2016-04-21 01:41:11 +0300
committerRémy Coutable <remy@rymai.me>2016-05-18 08:27:31 +0300
commit483c034b86262fb9b2c47df999d995f500b38eb4 (patch)
treed219b5f28b0ac95b7efde08ac2dac43bd3b942b2 /spec
parentda8ac1635f1c12e9455e7517bee29678c754d492 (diff)
Changing the confidentiality of an issue now creates a new system note
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r--spec/services/issues/update_service_spec.rb20
-rw-r--r--spec/services/system_note_service_spec.rb12
2 files changed, 26 insertions, 6 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index 52f69306994..c9d8f1b382c 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -27,11 +27,6 @@ describe Issues::UpdateService, services: true do
end
end
- def update_issue(opts)
- @issue = Issues::UpdateService.new(project, user, opts).execute(issue)
- @issue.reload
- end
-
context "valid params" do
before do
opts = {
@@ -39,7 +34,8 @@ describe Issues::UpdateService, services: true do
description: 'Also please fix',
assignee_id: user2.id,
state_event: 'close',
- label_ids: [label.id]
+ label_ids: [label.id],
+ confidential: true
}
perform_enqueued_jobs do
@@ -84,6 +80,18 @@ describe Issues::UpdateService, services: true do
expect(note).not_to be_nil
expect(note.note).to eq 'Title changed from **Old title** to **New title**'
end
+
+ it 'creates system note about confidentiality change' do
+ note = find_note('Marked as confidential')
+
+ expect(note).not_to be_nil
+ expect(note.note).to eq 'Marked as confidential'
+ end
+ end
+
+ def update_issue(opts)
+ @issue = Issues::UpdateService.new(project, user, opts).execute(issue)
+ @issue.reload
end
context 'todos' do
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 5fbf2ae5247..4fa60436155 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -254,6 +254,18 @@ describe SystemNoteService, services: true do
end
end
+ describe '.change_confidentiality' do
+ subject { described_class.change_confidentiality(noteable, project, author) }
+
+ context 'when noteable responds to `confidential`' do
+ it_behaves_like 'a system note'
+
+ it 'sets the note text' do
+ expect(subject.note).to eq "Marked as not confidential"
+ end
+ end
+ end
+
describe '.change_branch' do
subject { described_class.change_branch(noteable, project, author, 'target', old_branch, new_branch) }
let(:old_branch) { 'old_branch'}