Fix Github link
parent
44b89c8561
commit
5dab26c383
|
@ -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
|
||||
|
||||
|
|
|
@ -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: []
|
||||
|
|
Loading…
Reference in New Issue