95ed01749e
This commit adds CI/CD Badges Snippets for AsciiDoc as requested in #26087. I've however run into an issue in highlighting the snippet, it seems as if AsciiDoc is currently not being highlighted properly (displayed as plaintext) Add testcase for to_asciidoc Update test case for Badges list
31 lines
836 B
Ruby
31 lines
836 B
Ruby
shared_examples 'badge metadata' do
|
|
describe '#to_html' do
|
|
let(:html) { Nokogiri::HTML.parse(metadata.to_html) }
|
|
let(:a_href) { html.at('a') }
|
|
|
|
it 'points to link' do
|
|
expect(a_href[:href]).to eq metadata.link_url
|
|
end
|
|
|
|
it 'contains clickable image' do
|
|
expect(a_href.children.first.name).to eq 'img'
|
|
end
|
|
end
|
|
|
|
describe '#to_markdown' do
|
|
subject { metadata.to_markdown }
|
|
|
|
it { is_expected.to include metadata.image_url }
|
|
it { is_expected.to include metadata.link_url }
|
|
end
|
|
|
|
describe '#to_asciidoc' do
|
|
subject { metadata.to_asciidoc }
|
|
|
|
it { is_expected.to include metadata.image_url }
|
|
it { is_expected.to include metadata.link_url }
|
|
it { is_expected.to include 'image:' }
|
|
it { is_expected.to include 'link=' }
|
|
it { is_expected.to include 'title=' }
|
|
end
|
|
end
|