# Generates a link to a version
def link_to_version(version, options = {})
return '' unless version && version.is_a?(Version)
+ options = {:title => format_date(version.effective_date)}.merge(options)
link_to_if version.visible?, format_version_name(version), version_path(version), options
end
when 'Project'
html ? link_to_project(object) : object.to_s
when 'Version'
- html ? link_to(object.name, version_path(object)) : object.to_s
+ html ? link_to_version(object) : object.to_s
when 'TrueClass'
l(:general_text_Yes)
when 'FalseClass'
def test_index_with_fixed_version_column
get :index, :set_filter => 1, :c => %w(fixed_version)
assert_select 'table.issues td.fixed_version' do
- assert_select 'a[href=?]', '/versions/2', :text => '1.0'
+ assert_select 'a[href=?]', '/versions/2', :text => 'eCookbook - 1.0'
end
end
def test_link_to_version_within_project
@project = Project.find(2)
User.current = User.find(1)
- assert_equal '<a href="/versions/5">Alpha</a>', link_to_version(Version.find(5))
+ assert_equal '<a href="/versions/5" title="07/01/2006">Alpha</a>', link_to_version(Version.find(5))
end
def test_link_to_version
User.current = User.find(1)
- assert_equal '<a href="/versions/5">OnlineStore - Alpha</a>', link_to_version(Version.find(5))
+ assert_equal '<a href="/versions/5" title="07/01/2006">OnlineStore - Alpha</a>', link_to_version(Version.find(5))
+ end
+
+ def test_link_to_version_without_effective_date
+ User.current = User.find(1)
+ version = Version.find(5)
+ version.effective_date = nil
+ assert_equal '<a href="/versions/5">OnlineStore - Alpha</a>', link_to_version(version)
end
def test_link_to_private_version