spec/unit/puppet-strings/yard/util_spec.rb in puppet-strings-1.2.1 vs spec/unit/puppet-strings/yard/util_spec.rb in puppet-strings-2.0.0
- old
+ new
@@ -26,6 +26,23 @@
it 'should not affect a string which does not use %Q notation' do
str = "this is a test string"
expect(subject.scrub_string(str)).to eq('this is a test string')
end
end
+
+ describe 'github_to_yard_links' do
+ it 'converts a link correctly' do
+ str = '<a href="#module-description">'
+ expect(subject.github_to_yard_links(str)).to eq('<a href="#label-Module+description">')
+ end
+
+ it 'leaves other links with hashes alone' do
+ str = '<a href="www.github.com/blah/document.html#module-description">'
+ expect(subject.github_to_yard_links(str)).to eq(str)
+ end
+
+ it 'leaves plain text alone' do
+ str = '<a href="#module-description"> module-description'
+ expect(subject.github_to_yard_links(str)).to eq('<a href="#label-Module+description"> module-description')
+ end
+ end
end