summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-14 20:44:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-14 20:44:48 +0000
commit4ebdcf13db34186bb562ed523c637dd6edc86682 (patch)
tree66be2cc4561468a6163202aa8b663954767727c3 /test/unit
parentf607a7a023774362979ca5113a48e1138566b3bb (diff)
downloadredmine-4ebdcf13db34186bb562ed523c637dd6edc86682.tar.gz
redmine-4ebdcf13db34186bb562ed523c637dd6edc86682.zip
Add named routes for attachments and use route helpers in #link_to_attachment.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11187 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/helpers/application_helper_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index c5b3aaadc..506c30cc7 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -1063,6 +1063,20 @@ RAW
assert_equal ::I18n.t(:label_user_anonymous), t
end
+ def test_link_to_attachment
+ a = Attachment.find(3)
+ assert_equal '<a href="/attachments/3/logo.gif">logo.gif</a>',
+ link_to_attachment(a)
+ assert_equal '<a href="/attachments/3/logo.gif">Text</a>',
+ link_to_attachment(a, :text => 'Text')
+ assert_equal '<a href="/attachments/3/logo.gif" class="foo">logo.gif</a>',
+ link_to_attachment(a, :class => 'foo')
+ assert_equal '<a href="/attachments/download/3/logo.gif">logo.gif</a>',
+ link_to_attachment(a, :download => true)
+ assert_equal '<a href="http://test.host/attachments/3/logo.gif">logo.gif</a>',
+ link_to_attachment(a, :only_path => false)
+ end
+
def test_link_to_project
project = Project.find(1)
assert_equal %(<a href="/projects/ecookbook">eCookbook</a>),