Instiki 0.16.3: Rails 2.3.0

Instiki now runs on the Rails 2.3.0 Candidate Release.
Among other improvements, this means that it now 
automagically selects between WEBrick and Mongrel.

Just run

    ./instiki --daemon
This commit is contained in:
Jacques Distler 2009-02-04 14:26:08 -06:00
parent 43aadecc99
commit 4e14ccc74d
893 changed files with 71965 additions and 28511 deletions

View file

@ -6,7 +6,7 @@ require 'admin_controller'
# Raise errors beyond the default web-based presentation
class AdminController; def rescue_action(e) logger.error(e); raise e end; end
class AdminControllerTest < Test::Unit::TestCase
class AdminControllerTest < ActionController::TestCase
fixtures :webs, :pages, :revisions, :system, :wiki_references
def setup

View file

@ -6,7 +6,7 @@ require 'wiki_controller'
# Need some concrete class to test the abstract class features
class WikiController; def rescue_action(e) logger.error(e); raise e end; end
class ApplicationTest < Test::Unit::TestCase
class ApplicationTest < ActionController::TestCase
fixtures :webs, :pages, :revisions, :system
Mime::LOOKUP["text/html"] = HTML
@ -20,43 +20,43 @@ class ApplicationTest < Test::Unit::TestCase
def test_utf8_header
get :show, :web => 'wiki1', :id => 'HomePage'
assert_equal 'text/html; charset=utf-8', @response.headers['type']
assert_equal 'text/html; charset=utf-8', @response.headers['Content-Type']
end
def test_mathplayer_mime_type
@request.user_agent = 'MathPlayer'
get :show, :web => 'wiki1', :id => 'HomePage'
assert_equal 'application/xhtml+xml', @response.headers['type']
assert_equal 'application/xhtml+xml', @response.headers['Content-Type']
end
def test_validator_mime_type
@request.user_agent = 'Validator'
get :show, :web => 'wiki1', :id => 'HomePage'
assert_equal 'application/xhtml+xml; charset=utf-8', @response.headers['type']
assert_equal 'application/xhtml+xml; charset=utf-8', @response.headers['Content-Type']
end
def test_accept_header_xhtml
@request.user_agent = 'Mozilla/5.0'
@request.env.update({'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' })
get :show, :web => 'wiki1', :id => 'HomePage'
assert_equal 'application/xhtml+xml; charset=utf-8', @response.headers['type']
assert_equal 'application/xhtml+xml; charset=utf-8', @response.headers['Content-Type']
end
def test_accept_header_html
@request.user_agent = 'Foo'
@request.env.update({'HTTP_ACCEPT' => 'text/html,application/xml;q=0.9,*/*;q=0.8' })
get :show, :web => 'wiki1', :id => 'HomePage'
assert_equal 'text/html; charset=utf-8', @response.headers['type']
assert_equal 'text/html; charset=utf-8', @response.headers['Content-Type']
end
def test_tex_mime_type
get :tex, :web => 'wiki1', :id => 'HomePage'
assert_equal 'text/plain; charset=utf-8', @response.headers['type']
assert_equal 'text/plain; charset=utf-8', @response.headers['Content-Type']
end
def test_atom_mime_type
get :atom_with_content, :web => 'wiki1'
assert_equal 'application/atom+xml; charset=utf-8', @response.headers['type']
assert_equal 'application/atom+xml; charset=utf-8', @response.headers['Content-Type']
end
def test_connect_to_model_unknown_wiki

View file

@ -8,7 +8,7 @@ require 'stringio'
# Raise errors beyond the default web-based presentation
class FileController; def rescue_action(e) logger.error(e); raise e end; end
class FileControllerTest < Test::Unit::TestCase
class FileControllerTest < ActionController::TestCase
fixtures :webs, :pages, :revisions, :system
def setup
@ -41,7 +41,7 @@ class FileControllerTest < Test::Unit::TestCase
assert_response(:success, bypass_body_parsing = true)
assert_equal "Contents of the file", r.body
assert_equal 'text/plain', r.headers['type']
assert_equal 'text/plain', r.headers['Content-Type']
assert_equal 'inline; filename="foo.txt"', r.headers['Content-Disposition']
end
@ -53,7 +53,7 @@ class FileControllerTest < Test::Unit::TestCase
assert_response(:success, bypass_body_parsing = true)
assert_equal "Contents of the file", r.body
assert_equal 'application/octet-stream', r.headers['type']
assert_equal 'application/octet-stream', r.headers['Content-Type']
assert_equal 'attachment; filename="foo.html"', r.headers['Content-Disposition']
end
@ -65,7 +65,7 @@ class FileControllerTest < Test::Unit::TestCase
assert_response(:success, bypass_body_parsing = true)
assert_equal "aaa\nbbb\n", r.body
assert_equal 'application/pdf', r.headers['type']
assert_equal 'application/pdf', r.headers['Content-Type']
end
def test_pic_download_gif
@ -75,7 +75,7 @@ class FileControllerTest < Test::Unit::TestCase
r = get :file, :web => 'wiki1', :id => 'rails.gif'
assert_response(:success, bypass_body_parsing = true)
assert_equal 'image/gif', r.headers['type']
assert_equal 'image/gif', r.headers['Content-Type']
assert_equal pic.size, r.body.size
assert_equal pic, r.body
assert_equal 'inline; filename="rails.gif"', r.headers['Content-Disposition']

View file

@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../test_helper'
require 'action_controller/routing'
class RoutesTest < Test::Unit::TestCase
class RoutesTest < ActionController::TestCase
def test_parse_uri
assert_routing('', :controller => 'wiki', :action => 'index')

View file

@ -13,7 +13,7 @@ require 'zip/zipfilesystem'
# Raise errors beyond the default web-based presentation
class WikiController; def rescue_action(e) logger.error(e); raise e end; end
class WikiControllerTest < Test::Unit::TestCase
class WikiControllerTest < ActionController::TestCase
fixtures :webs, :pages, :revisions, :system, :wiki_references
def setup
@ -30,6 +30,7 @@ class WikiControllerTest < Test::Unit::TestCase
@home = @page = pages(:home_page)
@oak = pages(:oak)
@elephant = pages(:elephant)
@eternity = Regexp.new('author=.*; path=/; expires=' + Time.utc(2030).strftime("%a, %d-%b-%Y %H:%M:%S GMT"))
end
def test_authenticate
@ -37,7 +38,7 @@ class WikiControllerTest < Test::Unit::TestCase
get :authenticate, :web => 'wiki1', :password => 'pswd'
assert_redirected_to :web => 'wiki1', :action => 'show', :id => 'HomePage'
assert_equal ['pswd'], @response.cookies['wiki1']
assert_equal 'pswd', @response.cookies['wiki1']
end
def test_authenticate_wrong_password
@ -118,7 +119,7 @@ class WikiControllerTest < Test::Unit::TestCase
r = process 'export_html', 'web' => 'wiki1'
assert_response(:success, bypass_body_parsing = true)
assert_equal 'application/zip', r.headers['type']
assert_equal 'application/zip', r.headers['Content-Type']
assert_match /attachment; filename="wiki1-xhtml-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
r.headers['Content-Disposition']
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
@ -149,7 +150,7 @@ class WikiControllerTest < Test::Unit::TestCase
r = process 'export_html', 'web' => 'wiki1'
assert_response(:success, bypass_body_parsing = true)
assert_equal 'application/zip', r.headers['type']
assert_equal 'application/zip', r.headers['Content-Type']
assert_match /attachment; filename="wiki1-html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
r.headers['Content-Disposition']
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
@ -177,7 +178,7 @@ class WikiControllerTest < Test::Unit::TestCase
r = process 'export_html', 'web' => 'wiki1', 'layout' => 'no'
assert_response(:success, bypass_body_parsing = true)
assert_equal 'application/zip', r.headers['type']
assert_equal 'application/zip', r.headers['Content-Type']
assert_match /attachment; filename="wiki1-x?html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
r.headers['Content-Disposition']
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
@ -187,7 +188,7 @@ class WikiControllerTest < Test::Unit::TestCase
r = process 'export_markup', 'web' => 'wiki1'
assert_response(:success, bypass_body_parsing = true)
assert_equal 'application/zip', r.headers['type']
assert_equal 'application/zip', r.headers['Content-Type']
assert_match /attachment; filename="wiki1-markdownMML-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
r.headers['Content-Disposition']
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
@ -199,7 +200,7 @@ class WikiControllerTest < Test::Unit::TestCase
# def test_export_pdf
# r = process 'export_pdf', 'web' => 'wiki1'
# assert_response(:success, bypass_body_parsing = true)
# assert_equal 'application/pdf', r.headers['type']
# assert_equal 'application/pdf', r.headers['Content-Type']
# assert_match /attachment; filename="wiki1-tex-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.pdf"/,
# r.headers['Content-Disposition']
# assert_equal '%PDF', r.body[0..3]
@ -216,7 +217,7 @@ class WikiControllerTest < Test::Unit::TestCase
# r = process 'export_tex', 'web' => 'wiki1'
#
# assert_response(:success, bypass_body_parsing = true)
# assert_equal 'application/octet-stream', r.headers['type']
# assert_equal 'application/octet-stream', r.headers['Content-Type']
# assert_match /attachment; filename="wiki1-tex-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.tex"/,
# r.headers['Content-Disposition']
# assert_equal '\documentclass', r.body[0..13], 'Content is not a TeX file'
@ -296,7 +297,7 @@ class WikiControllerTest < Test::Unit::TestCase
# assert_equal '%PDF', r.body[0..3]
# assert_equal "EOF\n", r.body[-4..-1]
#
# assert_equal 'application/pdf', r.headers['type']
# assert_equal 'application/pdf', r.headers['Content-Type']
# assert_match /attachment; filename="HomePage-wiki1-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.pdf"/,
# r.headers['Content-Disposition']
# end
@ -591,8 +592,8 @@ class WikiControllerTest < Test::Unit::TestCase
'author' => 'AuthorOfNewPage'
assert_redirected_to :web => 'wiki1', :action => 'show', :id => 'NewPage'
assert_equal ['AuthorOfNewPage'], r.cookies['author'].value
assert_equal Time.utc(2030), r.cookies['author'].expires
assert_equal 'AuthorOfNewPage', r.cookies['author']
assert_match @eternity, r.headers["Set-Cookie"][0]
new_page = @wiki.read_page('wiki1', 'NewPage')
assert_equal 'Contents of a new page', new_page.content
assert_equal 'AuthorOfNewPage', new_page.author
@ -603,8 +604,8 @@ class WikiControllerTest < Test::Unit::TestCase
'author' => 'AuthorOfNewPage'
assert_redirected_to :web => 'wiki1', :action => 'new', :id => 'NewPage', :content => ''
assert_equal ['AuthorOfNewPage'], r.cookies['author'].value
assert_equal Time.utc(2030), r.cookies['author'].expires
assert_equal 'AuthorOfNewPage', r.cookies['author']
assert_match @eternity, r.headers["Set-Cookie"][0]
end
def test_save_not_utf8_ncr
@ -612,8 +613,8 @@ class WikiControllerTest < Test::Unit::TestCase
'author' => 'AuthorOfNewPage'
assert_redirected_to :web => 'wiki1', :action => 'new', :id => 'NewPage'
assert_equal ['AuthorOfNewPage'], r.cookies['author'].value
assert_equal Time.utc(2030), r.cookies['author'].expires
assert_equal 'AuthorOfNewPage', r.cookies['author']
assert_match @eternity, r.headers["Set-Cookie"][0]
end
def test_save_not_utf8_dec_ncr
@ -621,8 +622,8 @@ class WikiControllerTest < Test::Unit::TestCase
'author' => 'AuthorOfNewPage'
assert_redirected_to :web => 'wiki1', :action => 'new', :id => 'NewPage'
assert_equal ['AuthorOfNewPage'], r.cookies['author'].value
assert_equal Time.utc(2030), r.cookies['author'].expires
assert_equal 'AuthorOfNewPage', r.cookies['author']
assert_match @eternity, r.headers["Set-Cookie"][0]
end
def test_save_new_revision_of_existing_page
@ -633,7 +634,7 @@ class WikiControllerTest < Test::Unit::TestCase
'author' => 'Batman'
assert_redirected_to :web => 'wiki1', :action => 'show', :id => 'HomePage'
assert_equal ['Batman'], r.cookies['author'].value
assert_equal 'Batman', r.cookies['author']
home_page = @wiki.read_page('wiki1', 'HomePage')
assert_equal current_revisions+1, home_page.revisions.size
assert_equal 'Revised HomePage', home_page.content
@ -652,7 +653,7 @@ class WikiControllerTest < Test::Unit::TestCase
:content => 'HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}\includegraphics[width' +
'=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEng' +
'ine in that SmartEngineGUI'
assert_equal ['Batman'], r.cookies['author'].value
assert_equal 'Batman', r.cookies['author']
home_page = @wiki.read_page('wiki1', 'HomePage')
assert_equal current_revisions, home_page.revisions.size
assert_equal 'DavidHeinemeierHansson', home_page.author