diff options
Diffstat (limited to 'spec/services/incident_management/create_issue_service_spec.rb')
-rw-r--r-- | spec/services/incident_management/create_issue_service_spec.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/services/incident_management/create_issue_service_spec.rb b/spec/services/incident_management/create_issue_service_spec.rb index e720aafb897..4c7fb682193 100644 --- a/spec/services/incident_management/create_issue_service_spec.rb +++ b/spec/services/incident_management/create_issue_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' describe IncidentManagement::CreateIssueService do let(:project) { create(:project, :repository, :private) } - let(:user) { User.alert_bot } + let_it_be(:user) { User.alert_bot } let(:service) { described_class.new(project, alert_payload) } let(:alert_starts_at) { Time.now } let(:alert_title) { 'TITLE' } @@ -29,7 +29,6 @@ describe IncidentManagement::CreateIssueService do context 'when create_issue enabled' do let(:issue) { subject[:issue] } - let(:summary_separator) { "\n---\n\n" } before do setting.update!(create_issue: true) @@ -42,7 +41,7 @@ describe IncidentManagement::CreateIssueService do expect(issue.author).to eq(user) expect(issue.title).to eq(alert_title) expect(issue.description).to include(alert_presenter.issue_summary_markdown.strip) - expect(separator_count(issue.description)).to eq 0 + expect(separator_count(issue.description)).to eq(0) end end @@ -74,7 +73,7 @@ describe IncidentManagement::CreateIssueService do expect(subject).to include(status: :success) expect(issue.description).to include(alert_presenter.issue_summary_markdown) - expect(separator_count(issue.description)).to eq 1 + expect(separator_count(issue.description)).to eq(1) expect(issue.description).to include(template_content) end end @@ -134,7 +133,7 @@ describe IncidentManagement::CreateIssueService do expect(issue.description).to include(alert_presenter.issue_summary_markdown) expect(issue.description).to include(template_content) expect(issue.description).to include(alt_template) - expect(separator_count(issue.description)).to eq 2 + expect(separator_count(issue.description)).to eq(2) end end @@ -171,7 +170,7 @@ describe IncidentManagement::CreateIssueService do expect(issue.title).to include(query_title) expect(issue.title).to include('for 5 minutes') expect(issue.description).to include(alert_presenter.issue_summary_markdown.strip) - expect(separator_count(issue.description)).to eq 0 + expect(separator_count(issue.description)).to eq(0) end end @@ -306,6 +305,8 @@ describe IncidentManagement::CreateIssueService do end def separator_count(text) + summary_separator = "\n\n---\n\n" + text.scan(summary_separator).size end end |