uploading pics when not found in the file yard (same as for files)

This commit is contained in:
Alexey Verkhovsky 2005-01-23 13:42:56 +00:00
parent 8263e4bfcd
commit 44eea43940
5 changed files with 36 additions and 6 deletions

View file

@ -56,5 +56,12 @@ class FileControllerTest < Test::Unit::TestCase
assert_success
assert_equal File.size("#{FILE_AREA}/rails.gif"), r.binary_content.size
end
def test_pic_unknown_pic
r = process 'pic', 'web' => 'wiki1', 'id' => 'non-existant.gif'
assert_success
assert_rendered_file 'file/file'
end
end

View file

@ -3,6 +3,7 @@
require File.dirname(__FILE__) + '/../test_helper'
require 'web'
require 'revision'
require 'fileutils'
class RevisionTest < Test::Unit::TestCase
@ -210,6 +211,7 @@ class RevisionTest < Test::Unit::TestCase
end
def test_link_to_pic
@wiki.file_yard(@web).upload_file('square.jpg', StringIO.new(''))
assert_markup_parsed_as(
'<p><img alt="Square" src="../pic/square.jpg" /></p>',
'[[square.jpg|Square:pic]]')
@ -218,6 +220,17 @@ class RevisionTest < Test::Unit::TestCase
'[[square.jpg:pic]]')
end
def test_link_to_non_existant_pic
assert_markup_parsed_as(
'<p><span class="newWikiWord">NonExistant<a href="../pic/NonExistant.jpg">?</a>' +
'</span></p>',
'[[NonExistant.jpg|NonExistant:pic]]')
assert_markup_parsed_as(
'<p><span class="newWikiWord">NonExistant.jpg<a href="../pic/NonExistant.jpg">?</a>' +
'</span></p>',
'[[NonExistant.jpg:pic]]')
end
# TODO Remove the leading underscores from this test when upgrading to RedCloth 3.0.1;
# also add a test for the "Unhappy Face" problem (another interesting RedCloth bug)
def __test_list_with_tildas