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:
- 1892 Bytes
1 | require File.dirname(__FILE__) + '/../../test_helper' |
2 | require 'admin/comments_controller' |
3 | require 'dns_mock' |
4 | |
5 | # Re-raise errors caught by the controller. |
6 | class Admin::CommentsController; def rescue_action(e) raise e end; end |
7 | |
8 | class Admin::CommentsControllerTest < Test::Unit::TestCase |
9 | fixtures :articles, :comments, :users |
10 | |
11 | def setup |
12 | @controller = Admin::CommentsController.new |
13 | @request = ActionController::TestRequest.new |
14 | @response = ActionController::TestResponse.new |
15 | |
16 | @request.session = { :user => @tobi } |
17 | end |
18 | |
19 | def test_index |
20 | get :index, :article_id => 2 |
21 | assert_rendered_file 'list' |
22 | end |
23 | |
24 | def test_list |
25 | get :list, :article_id => 2 |
26 | assert_rendered_file 'list' |
27 | assert_template_has 'comments' |
28 | end |
29 | |
30 | def test_show |
31 | get :show, :id => 1, :article_id => 2 |
32 | assert_rendered_file 'show' |
33 | assert_template_has 'comment' |
34 | assert_valid_record 'comment' |
35 | end |
36 | |
37 | def test_new |
38 | get :new, :article_id => 2 |
39 | assert_rendered_file 'new' |
40 | assert_template_has 'comment' |
41 | end |
42 | |
43 | def test_create |
44 | num_comments = Comment.find_all.size |
45 | |
46 | post :new, :comment => { 'author' => 'author', 'body' => 'body' }, :article_id => 2 |
47 | assert_redirected_to :action => 'show' |
48 | |
49 | assert_equal num_comments + 1, Comment.find_all.size |
50 | end |
51 | |
52 | def test_edit |
53 | get :edit, :id => 1, :article_id => 2 |
54 | assert_rendered_file 'edit' |
55 | assert_template_has 'comment' |
56 | assert_valid_record 'comment' |
57 | end |
58 | |
59 | def test_update |
60 | post :edit, :id => 1, :article_id => 2 |
61 | assert_redirected_to :action => 'show', :id => 1 |
62 | end |
63 | |
64 | def test_destroy |
65 | assert_not_nil Comment.find(1) |
66 | |
67 | get :destroy, :id => 1, :article_id => 2 |
68 | assert_success |
69 | |
70 | post :destroy, :id => 1, :article_id => 2 |
71 | assert_redirected_to :action => 'list' |
72 | |
73 | assert_raise(ActiveRecord::RecordNotFound) { |
74 | comment = Comment.find(1) |
75 | } |
76 | end |
77 | end |