diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-19 19:27:09 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-19 19:27:09 +0300 |
commit | bbf0a04f5ea1600a65feeded6bf3e8839d600ff6 (patch) | |
tree | 5782755d8fd7781f3705bf512ac39d5c72cf34ea /spec | |
parent | 52846d4b7fa49a8b29ba85dbcf16ff95f75e8619 (diff) | |
parent | 0698113cabe68f23ac38d7b2fde6c5cb7e5bec4f (diff) |
Merge branch 'mooreniemi/gitlab-ce-issue_15236' into 'master'
Changing the confidentiality of an issue now creates a new system note
Closes #15236.
See merge request !4189
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 20 | ||||
-rw-r--r-- | spec/services/system_note_service_spec.rb | 12 |
2 files changed, 22 insertions, 10 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 52f69306994..810a1f2d666 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('Made the issue confidential') + + expect(note).not_to be_nil + expect(note.note).to eq 'Made the issue 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..bffad59b8b6 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -244,12 +244,16 @@ describe SystemNoteService, services: true do to eq "Title changed from **Old title** to **#{noteable.title}**" end end + end - context 'when noteable does not respond to `title' do - let(:noteable) { double('noteable') } + describe '.change_issue_confidentiality' do + subject { described_class.change_issue_confidentiality(noteable, project, author) } - it 'returns nil' do - expect(subject).to be_nil + context 'when noteable responds to `confidential`' do + it_behaves_like 'a system note' + + it 'sets the note text' do + expect(subject.note).to eq 'Made the issue visible' end end end |