summaryrefslogtreecommitdiff
path: root/spec/services/system_note_service_spec.rb
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-04-04 12:36:58 +0200
committerJarka Kadlecova <jarka@gitlab.com>2017-04-04 12:36:58 +0200
commitd67d43d1b693a37da73c8469e9b5c6c6f53ed0fa (patch)
treef225c33d0ed0d7bc3a69fc6610c29504617fccad /spec/services/system_note_service_spec.rb
parentb57ed57f6b0100b2f8c5b062bac10628ce3bbacd (diff)
downloadgitlab-ce-d67d43d1b693a37da73c8469e9b5c6c6f53ed0fa.tar.gz
Split status and confidentiality action
Diffstat (limited to 'spec/services/system_note_service_spec.rb')
-rw-r--r--spec/services/system_note_service_spec.rb35
1 files changed, 23 insertions, 12 deletions
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 90cde705b85..5ec1ed8237b 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -221,26 +221,23 @@ describe SystemNoteService, services: true do
describe '.change_status' do
subject { described_class.change_status(noteable, project, author, status, source) }
- let(:status) { 'new_status' }
- let(:source) { nil }
+ context 'with status reopened' do
+ let(:status) { 'reopened' }
+ let(:source) { nil }
- it_behaves_like 'a system note' do
- let(:action) { 'status' }
+ it_behaves_like 'a system note' do
+ let(:action) { 'opened' }
+ end
end
context 'with a source' do
+ let(:status) { 'opened' }
let(:source) { double('commit', gfm_reference: 'commit 123456') }
it 'sets the note text' do
expect(subject.note).to eq "#{status} via commit 123456"
end
end
-
- context 'without a source' do
- it 'sets the note text' do
- expect(subject.note).to eq status
- end
- end
end
describe '.merge_when_pipeline_succeeds' do
@@ -298,9 +295,23 @@ describe SystemNoteService, services: true do
describe '.change_issue_confidentiality' do
subject { described_class.change_issue_confidentiality(noteable, project, author) }
- context 'when noteable responds to `confidential`' do
+ context 'issue has been made confidential' do
+ before do
+ noteable.update_attribute(:confidential, true)
+ end
+
+ it_behaves_like 'a system note' do
+ let(:action) { 'confidential' }
+ end
+
+ it 'sets the note text' do
+ expect(subject.note).to eq 'made the issue confidential'
+ end
+ end
+
+ context 'issue has been made visible' do
it_behaves_like 'a system note' do
- let(:action) { 'confidentiality' }
+ let(:action) { 'visible' }
end
it 'sets the note text' do