diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-24 03:34:57 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-24 03:34:57 +0000 |
commit | 627dfd80b6371a44bdfa6825aa1ed0078a0f1dde (patch) | |
tree | 377b4f6d6f365657340bb65c385dfab4c154676c /test/unit | |
parent | 7bae592e626d9e8cde6678adff76958ce47f3433 (diff) | |
download | redmine-627dfd80b6371a44bdfa6825aa1ed0078a0f1dde.tar.gz redmine-627dfd80b6371a44bdfa6825aa1ed0078a0f1dde.zip |
add unit application helper test to use latest image file (#3261)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7907 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 131959a25..cc05fad34 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -29,6 +29,7 @@ class ApplicationHelperTest < ActionView::TestCase def setup super + set_tmp_attachments_directory end context "#link_to_if_authorized" do @@ -182,6 +183,30 @@ RAW to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) } end + def test_attached_images_should_read_later + Attachment.storage_path = "#{Rails.root}/test/fixtures/files" + a1 = Attachment.find(16) + assert_equal "testfile.png", a1.filename + assert a1.readable? + assert (! a1.visible?(User.anonymous)) + assert a1.visible?(User.find(2)) + a2 = Attachment.find(17) + assert_equal "testfile.PNG", a2.filename + assert a2.readable? + assert (! a2.visible?(User.anonymous)) + assert a2.visible?(User.find(2)) + assert a1.created_on < a2.created_on + + to_test = { + 'Inline image: !testfile.png!' => + 'Inline image: <img src="/attachments/download/' + a2.id.to_s + '" alt="" />', + 'Inline image: !Testfile.PNG!' => + 'Inline image: <img src="/attachments/download/' + a2.id.to_s + '" alt="" />', + } + attachments = [a1, a2] + to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) } + end + def test_textile_external_links to_test = { 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>', |