Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 1790 Bytes
1 | require File.dirname(__FILE__) + '/../../test_helper' |
2 | require 'admin/content_controller' |
3 | |
4 | # Re-raise errors caught by the controller. |
5 | class Admin::ContentController; def rescue_action(e) raise e end; end |
6 | |
7 | class Admin::ContentControllerTest < Test::Unit::TestCase |
8 | fixtures :articles, :users |
9 | |
10 | def setup |
11 | @controller = Admin::ContentController.new |
12 | @request = ActionController::TestRequest.new |
13 | @response = ActionController::TestResponse.new |
14 | @request.session = { :user => @tobi } |
15 | end |
16 | |
17 | def test_index |
18 | get :index |
19 | assert_rendered_file 'list' |
20 | end |
21 | |
22 | def test_list |
23 | get :list |
24 | assert_rendered_file 'list' |
25 | assert_template_has 'articles' |
26 | end |
27 | |
28 | def test_show |
29 | get :show, 'id' => 1 |
30 | assert_rendered_file 'show' |
31 | assert_template_has 'article' |
32 | assert_valid_record 'article' |
33 | end |
34 | |
35 | def test_new |
36 | get :new |
37 | assert_rendered_file 'new' |
38 | assert_template_has 'article' |
39 | end |
40 | |
41 | def test_create |
42 | num_articles = Article.find_all.size |
43 | |
44 | post :new, 'article' => { :title => "posted via tests!" } |
45 | assert_redirected_to :action => 'show' |
46 | |
47 | assert_equal num_articles + 1, Article.find_all.size |
48 | |
49 | new_article = Article.find(:first, :order => "id DESC") |
50 | assert_equal @tobi, new_article.user |
51 | end |
52 | |
53 | def test_edit |
54 | get :edit, 'id' => 1 |
55 | assert_rendered_file 'edit' |
56 | assert_template_has 'article' |
57 | assert_valid_record 'article' |
58 | end |
59 | |
60 | def test_update |
61 | post :edit, 'id' => 1 |
62 | assert_redirected_to :action => 'show', :id => 1 |
63 | end |
64 | |
65 | def test_destroy |
66 | assert_not_nil Article.find(1) |
67 | |
68 | get :destroy, 'id' => 1 |
69 | assert_success |
70 | |
71 | post :destroy, 'id' => 1 |
72 | assert_redirected_to :action => 'list' |
73 | |
74 | assert_raise(ActiveRecord::RecordNotFound) { |
75 | article = Article.find(1) |
76 | } |
77 | end |
78 | end |