2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.shared_examples 'badge metadata' do
|
2016-09-13 17:45:13 +05:30
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
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
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|