Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 173
- Log:
Updated to latest release of Beast according to the "getting started with
Beast" guide at:http://beast.caboo.se/forums/1/topics/381
This check-in includes frozen Edge Rails and has the beginnings of
configuration for the ROOL site included.
- Author:
- rool
- Date:
- Fri Mar 02 15:59:12 +0000 2007
- Size:
- 3472 Bytes
1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | require 'forums_controller' |
3 | |
4 | # Re-raise errors caught by the controller. |
5 | class ForumsController; def rescue_action(e) raise e end; end |
6 | |
7 | class ForumsControllerTest < Test::Unit::TestCase |
8 | all_fixtures |
9 | |
10 | def setup |
11 | @controller = ForumsController.new |
12 | @request = ActionController::TestRequest.new |
13 | @response = ActionController::TestResponse.new |
14 | end |
15 | |
16 | def test_remember_me_logs_into_home |
17 | @request.cookies['login_token'] = CGI::Cookie.new('login_token', [users(:sam).id.to_s, users(:sam).login_key].join(';')) |
18 | get :index |
19 | assert_equal users(:sam).id, session[:user_id] |
20 | end |
21 | |
22 | def test_remember_me_logs_in_when_login_required |
23 | users(:aaron).login_key = "8305f94ab2b92f99137abbc235ee28e5" |
24 | users(:aaron).login_key_expires_at = Time.now.utc+1.week |
25 | users(:aaron).save! |
26 | @request.cookies['login_token'] = CGI::Cookie.new('login_token', [users(:aaron).id.to_s, users(:aaron).login_key].join(';')) |
27 | get :edit, :id => users(:aaron).id |
28 | assert_equal users(:aaron).id, session[:user_id] |
29 | end |
30 | |
31 | |
32 | def test_should_get_index |
33 | get :index |
34 | assert_response :success |
35 | assert assigns(:forums) |
36 | assert_select 'html>head' |
37 | end |
38 | |
39 | def test_should_get_index_with_xml |
40 | content_type 'application/xml' |
41 | get :index, :format => 'xml' |
42 | assert_response :success |
43 | assert_select 'forums>forum' |
44 | end |
45 | |
46 | def test_should_get_new |
47 | login_as :aaron |
48 | get :new |
49 | assert_response :success |
50 | end |
51 | |
52 | def test_should_require_admin |
53 | login_as :sam |
54 | get :new |
55 | assert_redirected_to login_path |
56 | end |
57 | |
58 | def test_should_create_forum |
59 | login_as :aaron |
60 | assert_difference Forum, :count do |
61 | post :create, :forum => { :name => 'yeah' } |
62 | end |
63 | |
64 | assert_redirected_to forums_path |
65 | end |
66 | |
67 | def test_should_create_forum_with_xml |
68 | content_type 'application/xml' |
69 | authorize_as :aaron |
70 | |
71 | assert_difference Forum, :count do |
72 | post :create, :forum => { :name => 'yeah' }, :format => 'xml' |
73 | end |
74 | |
75 | assert_response :created |
76 | assert_equal formatted_forum_url(:id => assigns(:forum), :format => :xml), @response.headers["Location"] |
77 | end |
78 | |
79 | def test_should_show_forum |
80 | get :show, :id => 1 |
81 | assert_response :success |
82 | assert assigns(:topics) |
83 | # sticky should be first |
84 | assert_equal(topics(:sticky), assigns(:topics).first) |
85 | assert_select 'html>head' |
86 | end |
87 | |
88 | def test_should_show_forum_with_xml |
89 | content_type 'application/xml' |
90 | get :show, :id => 1, :format => 'xml' |
91 | assert_response :success |
92 | assert_select 'forum' |
93 | end |
94 | |
95 | def test_should_get_edit |
96 | login_as :aaron |
97 | get :edit, :id => 1 |
98 | assert_response :success |
99 | end |
100 | |
101 | def test_should_update_forum |
102 | login_as :aaron |
103 | put :update, :id => 1, :forum => { } |
104 | assert_redirected_to forums_path |
105 | end |
106 | |
107 | def test_should_update_forum_with_xml |
108 | authorize_as :aaron |
109 | content_type 'application/xml' |
110 | put :update, :id => 1, :forum => { }, :format => 'xml' |
111 | assert_response :success |
112 | end |
113 | |
114 | def test_should_destroy_forum |
115 | login_as :aaron |
116 | old_count = Forum.count |
117 | delete :destroy, :id => 1 |
118 | assert_equal old_count-1, Forum.count |
119 | |
120 | assert_redirected_to forums_path |
121 | end |
122 | |
123 | def test_should_destroy_forum_with_xml |
124 | authorize_as :aaron |
125 | content_type 'application/xml' |
126 | old_count = Forum.count |
127 | delete :destroy, :id => 1, :format => 'xml' |
128 | assert_equal old_count-1, Forum.count |
129 | assert_response :success |
130 | end |
131 | end |