Fix Github link

master
Zequez 2015-08-01 17:31:36 -03:00
parent 44b89c8561
commit 5dab26c383
2 changed files with 13 additions and 1 deletions

View File

@ -132,7 +132,7 @@ class ModDecorator < Draper::Decorator
end
def github_link
return na unless mod.github
return na unless mod.github.present?
h.link_to mod.github_url, mod.github_url
end

View File

@ -60,6 +60,18 @@ describe ModDecorator do
end
end
describe '#github_link' do
it 'should return a link to the project Github URL if available' do
mod = create_decorated(:mod, github: 'potato/salad')
expect(mod.github_link).to eq '<a href="http://github.com/potato/salad">http://github.com/potato/salad</a>'
end
it 'should return N/A if #github_path not present' do
mod = create_decorated(:mod, github: '')
expect(mod.github_link).to eq 'N/A'
end
end
describe '#has_versions?' do
it 'should return false if the mod has no versions' do
mod = create_decorated :mod, versions: []