Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 2730 Bytes
1 | require File.dirname(__FILE__) + '/../../test_helper' |
2 | require 'admin/pages_controller' |
3 | |
4 | # Re-raise errors caught by the controller. |
5 | class Admin::PagesController; def rescue_action(e) raise e end; end |
6 | |
7 | class Admin::PagesControllerTest < Test::Unit::TestCase |
8 | fixtures :contents, :users, :text_filters, :blogs |
9 | |
10 | def setup |
11 | @controller = Admin::PagesController.new |
12 | @request = ActionController::TestRequest.new |
13 | @response = ActionController::TestResponse.new |
14 | @request.session = { :user => users(:tobi) } |
15 | end |
16 | |
17 | def test_index |
18 | get :index |
19 | assert_response :success |
20 | assert_template "list" |
21 | end |
22 | |
23 | def test_list |
24 | get :list |
25 | assert_response :success |
26 | assert_template "list" |
27 | |
28 | assert_not_nil assigns(:pages) |
29 | assert_equal Page.count, assigns(:pages).size |
30 | |
31 | assert_not_nil assigns(:page) |
32 | assert_equal TextFilter.find_by_name(this_blog.text_filter), assigns(:page).text_filter |
33 | end |
34 | |
35 | def test_show |
36 | get :show, :id => contents(:first_page).id |
37 | assert_response :success |
38 | assert_template "show" |
39 | |
40 | assert_not_nil assigns(:page) |
41 | assert_equal contents(:first_page), assigns(:page) |
42 | end |
43 | |
44 | def test_new |
45 | get :new |
46 | assert_response :success |
47 | assert_template "new" |
48 | assert_not_nil assigns(:page) |
49 | |
50 | assert_equal users(:tobi), assigns(:page).user |
51 | assert_equal TextFilter.find_by_name(this_blog.text_filter), assigns(:page).text_filter |
52 | |
53 | post :new, :page => { :name => "new_page", :title => "New Page Title", |
54 | :body => "Emphasis _mine_, arguments *strong*" } |
55 | |
56 | new_page = Page.find(:first, :order => "id DESC") |
57 | |
58 | assert_equal "new_page", new_page.name |
59 | |
60 | assert_response :redirect, :action => "show", :id => new_page.id |
61 | |
62 | # XXX: The flash is currently being made available improperly to tests (scoop) |
63 | #assert_equal "Page was successfully created.", flash[:notice] |
64 | end |
65 | |
66 | def test_edit |
67 | get :edit, :id => contents(:markdown_page).id |
68 | assert_response :success |
69 | assert_template "edit" |
70 | assert_not_nil assigns(:page) |
71 | |
72 | assert_equal contents(:markdown_page), assigns(:page) |
73 | |
74 | post :edit, :id => contents(:markdown_page).id, :page => { :name => "markdown-page", :title => "Markdown Page", |
75 | :body => "Adding a [link](http://www.typosphere.org/) here" } |
76 | |
77 | assert_response :redirect, :action => "show", :id => contents(:markdown_page).id |
78 | |
79 | # XXX: The flash is currently being made available improperly to tests (scoop) |
80 | #assert_equal "Page was successfully updated.", flash[:notice] |
81 | end |
82 | |
83 | def test_destroy |
84 | post :destroy, :id => contents(:another_page).id |
85 | assert_response :redirect, :action => "list" |
86 | assert_raise(ActiveRecord::RecordNotFound) { Page.find(contents(:another_page).id) } |
87 | end |
88 | end |