Commit cb5ae9a8 authored by Dan Davison's avatar Dan Davison Committed by Mark Lapierre

Add quarantine tag message

Add spec for adding a message to
quarantined tests
parent ee46dd70
...@@ -43,7 +43,23 @@ module QA::Specs::Helpers ...@@ -43,7 +43,23 @@ module QA::Specs::Helpers
# the quarantined tests when they're not run so that we're aware of them # the quarantined tests when they're not run so that we're aware of them
skip("Only running tests tagged with :quarantine and any of #{included_filters.keys}") if should_skip_when_focused?(example.metadata, included_filters) skip("Only running tests tagged with :quarantine and any of #{included_filters.keys}") if should_skip_when_focused?(example.metadata, included_filters)
else else
skip('In quarantine') if example.metadata.key?(:quarantine) if example.metadata.key?(:quarantine)
quarantine_message = %w(In quarantine)
quarantine_tag = example.metadata[:quarantine]
if !!quarantine_tag
quarantine_message << case quarantine_tag
when String
": #{quarantine_tag}"
when Hash
": #{quarantine_tag[:issue]}"
else
''
end
end
skip(quarantine_message.join(' ').strip)
end
end end
end end
......
...@@ -155,6 +155,26 @@ describe QA::Specs::Helpers::Quarantine do ...@@ -155,6 +155,26 @@ describe QA::Specs::Helpers::Quarantine do
expect(group.examples.first.execution_result.status).to eq(:passed) expect(group.examples.first.execution_result.status).to eq(:passed)
end end
context 'quarantine message' do
shared_examples 'test with quarantine message' do |quarantine_tag|
it 'outputs the quarantine message' do
group = describe_successfully do
it('is quarantined', quarantine: quarantine_tag) {}
end
expect(group.examples.first.execution_result.pending_message)
.to eq('In quarantine : for a reason')
end
end
it_behaves_like 'test with quarantine message', 'for a reason'
it_behaves_like 'test with quarantine message', {
issue: 'for a reason',
environment: [:nightly, :staging]
}
end
end end
context 'with :quarantine focused' do context 'with :quarantine focused' do
......
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