Commit 4190ebe2 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Refactor Prometheus::AlertPresenter specs

Refactor AlertPresenter specs to check an actual
markdown instead of included parts.
parent f06ac15a
...@@ -41,9 +41,14 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -41,9 +41,14 @@ describe Projects::Prometheus::AlertPresenter do
context 'without default payload' do context 'without default payload' do
it do it do
is_expected.to include('## Summary') is_expected.to eq(
is_expected.to include('* starts_at:') <<~MARKDOWN.chomp
is_expected.not_to include('* full_query:') ## Summary
* starts_at: #{presenter.starts_at}
MARKDOWN
)
end end
end end
...@@ -53,8 +58,15 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -53,8 +58,15 @@ describe Projects::Prometheus::AlertPresenter do
end end
it do it do
is_expected.to include('* foo: value1') is_expected.to eq(
is_expected.to include('* bar: value2') <<~MARKDOWN.chomp
## Summary
* starts_at: #{presenter.starts_at}
* foo: value1
* bar: value2
MARKDOWN
)
end end
end end
...@@ -63,7 +75,17 @@ describe Projects::Prometheus::AlertPresenter do ...@@ -63,7 +75,17 @@ describe Projects::Prometheus::AlertPresenter do
payload['generatorURL'] = 'http://host?g0.expr=query' payload['generatorURL'] = 'http://host?g0.expr=query'
end end
it { is_expected.to include('* full_query: `query`') } it do
is_expected.to eq(
<<~MARKDOWN.chomp
## Summary
* starts_at: #{presenter.starts_at}
* full_query: `query`
MARKDOWN
)
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment