Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
1f4f1a4ba3
6 changed files with 30 additions and 13 deletions
|
@ -65,11 +65,25 @@ end
|
|||
# It provides a easy way to test whether a chunk matches a particular string
|
||||
# and any the values of any fields that should be set after a match.
|
||||
class ContentStub < String
|
||||
|
||||
attr_reader :web
|
||||
|
||||
include ChunkManager
|
||||
def initialize(str)
|
||||
super
|
||||
init_chunk_manager
|
||||
@web = Object.new
|
||||
class << @web
|
||||
def address
|
||||
'wiki1'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def url_generator
|
||||
StubUrlGenerator.new
|
||||
end
|
||||
|
||||
def page_link(*); end
|
||||
end
|
||||
|
||||
|
@ -108,7 +122,11 @@ class StubUrlGenerator < AbstractUrlGenerator
|
|||
end
|
||||
|
||||
def url_for(hash = {})
|
||||
'../files/pngs'
|
||||
if(hash[:action] == 'list')
|
||||
"http://example.com/#{hash[:web]}/list"
|
||||
else
|
||||
'../files/pngs'
|
||||
end
|
||||
end
|
||||
|
||||
def file_link(mode, name, text, web_name, known_file, description)
|
||||
|
|
|
@ -7,8 +7,10 @@ class CategoryTest < Test::Unit::TestCase
|
|||
include ChunkMatch
|
||||
|
||||
def test_single_category
|
||||
match(Category, 'category: test', :list => ['test'], :hidden => nil)
|
||||
match(Category, 'category : chunk test ', :list => ['chunk test'], :hidden => nil)
|
||||
match(Category, 'category: test', :list => ['test'], :hidden => nil, :unmask_text =>
|
||||
"<div class=\"property\"> category: <a class=\"category_link\" href=\"http://example.com/wiki1/list/test\">test</a></div>")
|
||||
match(Category, 'category : chunk test ', :list => ['chunk test'], :hidden => nil, :unmask_text =>
|
||||
"<div class=\"property\"> category: <a class=\"category_link\" href=\"http://example.com/wiki1/list/chunk+test\">chunk test</a></div>")
|
||||
match(Category, ':category: test', :list => ['test'], :hidden => ':')
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue