summaryrefslogtreecommitdiff
path: root/spec/services/system_note_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/system_note_service_spec.rb')
-rw-r--r--spec/services/system_note_service_spec.rb44
1 files changed, 40 insertions, 4 deletions
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 969e5955609..47b8621b5c9 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -74,15 +74,37 @@ RSpec.describe SystemNoteService do
end
end
- describe '.change_milestone' do
- let(:milestone) { double }
+ describe '.relate_issue' do
+ let(:noteable_ref) { double }
+ let(:noteable) { double }
+
+ before do
+ allow(noteable).to receive(:project).and_return(double)
+ end
it 'calls IssuableService' do
expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
- expect(service).to receive(:change_milestone).with(milestone)
+ expect(service).to receive(:relate_issue).with(noteable_ref)
end
- described_class.change_milestone(noteable, project, author, milestone)
+ described_class.relate_issue(noteable, noteable_ref, double)
+ end
+ end
+
+ describe '.unrelate_issue' do
+ let(:noteable_ref) { double }
+ let(:noteable) { double }
+
+ before do
+ allow(noteable).to receive(:project).and_return(double)
+ end
+
+ it 'calls IssuableService' do
+ expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
+ expect(service).to receive(:unrelate_issue).with(noteable_ref)
+ end
+
+ described_class.unrelate_issue(noteable, noteable_ref, double)
end
end
@@ -313,6 +335,7 @@ RSpec.describe SystemNoteService do
let(:success_message) { "SUCCESS: Successfully posted to http://jira.example.net." }
before do
+ stub_jira_service_test
stub_jira_urls(jira_issue.id)
jira_service_settings
end
@@ -705,4 +728,17 @@ RSpec.describe SystemNoteService do
described_class.new_alert_issue(alert, alert.issue, author)
end
end
+
+ describe '.create_new_alert' do
+ let(:alert) { build(:alert_management_alert) }
+ let(:monitoring_tool) { 'Prometheus' }
+
+ it 'calls AlertManagementService' do
+ expect_next_instance_of(SystemNotes::AlertManagementService) do |service|
+ expect(service).to receive(:create_new_alert).with(monitoring_tool)
+ end
+
+ described_class.create_new_alert(alert, monitoring_tool)
+ end
+ end
end