From cb5fce04426df4803726c874e0e9e9285cdd7837 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 8 Jul 2018 00:27:58 +0000 Subject: Adds link to container to attachment view (#29190). Patch by Gregor Schmidt. git-svn-id: http://svn.redmine.org/redmine/trunk@17435 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/helpers/application_helper_test.rb | 46 ++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'test/helpers') diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 34e4fe119..e28a56797 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -31,7 +31,8 @@ class ApplicationHelperTest < Redmine::HelperTest :trackers, :issue_statuses, :issues, :versions, :documents, :wikis, :wiki_pages, :wiki_contents, :boards, :messages, :news, - :attachments, :enumerations + :attachments, :enumerations, + :custom_values, :custom_fields, :custom_fields_projects def setup super @@ -1490,6 +1491,49 @@ RAW link_to_project(Project.find(1)) end + def test_link_to_record + [ + [custom_values(:custom_values_007), 'eCookbook'], + [documents(:documents_001), 'Test document'], + [Group.find(10), 'A Team'], + [issues(:issues_001), link_to_issue(issues(:issues_001), :subject => false)], + [messages(:messages_001), 'First post'], + [news(:news_001), 'eCookbook first release !'], + [projects(:projects_001), 'eCookbook'], + [users(:users_001), 'Redmine Admin'], + [versions(:versions_001), 'eCookbook - 0.1'], + [wiki_pages(:wiki_pages_001), 'CookBook documentation'] + ].each do |record, link| + assert_equal link, link_to_record(record) + end + end + + def test_link_to_attachment_container + field = ProjectCustomField.generate!(:name => "File", :field_format => 'attachment') + project = projects(:projects_001) + project_custom_value_attachment = new_record(Attachment) do + project.custom_field_values = {field.id => {:file => mock_file}} + project.save + end + + news_attachment = attachments(:attachments_004) + news_attachment.container = news(:news_001) + news_attachment.save! + + [ + [project_custom_value_attachment, 'eCookbook'], + [attachments(:attachments_002), 'Test document'], + [attachments(:attachments_001), link_to_issue(issues(:issues_003), :subject => false)], + [attachments(:attachments_013), 'First post'], + [news_attachment, 'eCookbook first release !'], + [attachments(:attachments_008), 'Files'], + [attachments(:attachments_009), 'Files'], + [attachments(:attachments_003), 'Page with an inline image'], + ].each do |attachment, link| + assert_equal link, link_to_attachment_container(attachment.container) + end + end + def test_principals_options_for_select_with_users User.current = nil users = [User.find(2), User.find(4)] -- cgit v1.2.3