Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-12-13 20:02:24 -06:00
commit a02ada047a
2 changed files with 14 additions and 3 deletions

View file

@ -392,7 +392,8 @@ class WikiController < ApplicationController
def truncate(text, length = 30, truncate_string = '...')
return text if text.length <= length
len = length - truncate_string.length
text.split.inject('') do |t, word|
t = ''
text.split.collect do | word|
if t.length + word.length <= len
t << word + ' '
else

View file

@ -38,9 +38,9 @@ class WikiControllerTest < ActionController::TestCase
def test_truncate_page_name
wanted_page_name = 'This is a very, very, very, very, VERY long page name'
evil_page_name = 'This page name has lots of fun &amp; games'
evil_page_name = 'This page has plenty of fun &amp; games'
assert_equal 'This is a very, very, very,...', @controller.truncate(WikiWords.separate(wanted_page_name), 35)
assert_equal 'This page name has lots of...', @controller.truncate(WikiWords.separate(evil_page_name))
assert_equal 'This page has plenty of fun...', @controller.truncate(WikiWords.separate(evil_page_name))
end
def test_authenticate
@ -323,6 +323,16 @@ class WikiControllerTest < ActionController::TestCase
end
def test_source
r = process('source', 'web' => 'wiki1', 'id' => 'HomePage')
assert_response(:success)
assert_match Regexp.new(Regexp.escape(%{HisWay would be MyWay $\\sin(x)\\begin{svg}&} +
%{lt;svg/&gt;\\end{svg}\\includegraphics\[width=3em\]{foo}$ in kinda} +
%{ ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in t} +
%{hat SmartEngineGUI})), r.body
end
def test_published
set_web_property :published, true