##// END OF EJS Templates
add unit application helper test to use latest image file (#3261)...
Toshi MARUYAMA -
r7787:627dfd80b637
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -182,3 +182,29 attachments_015:
182 author_id: 2
182 author_id: 2
183 content_type: text/x-diff
183 content_type: text/x-diff
184 description: attachement of a private issue
184 description: attachement of a private issue
185 attachments_016:
186 content_type: image/png
187 downloads: 0
188 created_on: 2010-11-23 16:14:50 +09:00
189 disk_filename: 101123161450_testfile_1.png
190 container_id: 14
191 digest: 8e0294de2441577c529f170b6fb8f638
192 id: 16
193 container_type: Issue
194 description: ""
195 filename: testfile.png
196 filesize: 2654
197 author_id: 2
198 attachments_017:
199 content_type: image/png
200 downloads: 0
201 created_on: 2010-12-23 16:14:50 +09:00
202 disk_filename: 101223161450_testfile_2.png
203 container_id: 14
204 digest: 6bc2963e8d7ea0d3e68d12d1fba3d6ca
205 id: 17
206 container_type: Issue
207 description: ""
208 filename: testfile.PNG
209 filesize: 3582
210 author_id: 2
@@ -29,6 +29,7 class ApplicationHelperTest < ActionView::TestCase
29
29
30 def setup
30 def setup
31 super
31 super
32 set_tmp_attachments_directory
32 end
33 end
33
34
34 context "#link_to_if_authorized" do
35 context "#link_to_if_authorized" do
@@ -182,6 +183,30 RAW
182 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
183 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
183 end
184 end
184
185
186 def test_attached_images_should_read_later
187 Attachment.storage_path = "#{Rails.root}/test/fixtures/files"
188 a1 = Attachment.find(16)
189 assert_equal "testfile.png", a1.filename
190 assert a1.readable?
191 assert (! a1.visible?(User.anonymous))
192 assert a1.visible?(User.find(2))
193 a2 = Attachment.find(17)
194 assert_equal "testfile.PNG", a2.filename
195 assert a2.readable?
196 assert (! a2.visible?(User.anonymous))
197 assert a2.visible?(User.find(2))
198 assert a1.created_on < a2.created_on
199
200 to_test = {
201 'Inline image: !testfile.png!' =>
202 'Inline image: <img src="/attachments/download/' + a2.id.to_s + '" alt="" />',
203 'Inline image: !Testfile.PNG!' =>
204 'Inline image: <img src="/attachments/download/' + a2.id.to_s + '" alt="" />',
205 }
206 attachments = [a1, a2]
207 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
208 end
209
185 def test_textile_external_links
210 def test_textile_external_links
186 to_test = {
211 to_test = {
187 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
212 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
General Comments 0
You need to be logged in to leave comments. Login now