Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 171
- Log:
Initial import of Beast 0.9 from downloaded Tarball. Beast is a Ruby
On Rails based forum application. The original tarball came from the
following location:http://s3.amazonaws.com/beast-forum/beast-0.9.tar.gz
The forum post which announced this version's availability was at:
http://beast.caboo.se/forums/1/topics/446
- Author:
- rool
- Date:
- Fri Mar 02 15:51:55 +0000 2007
- Size:
- 3776 Bytes
1 | require "#{File.dirname(__FILE__)}/../test_helper" |
2 | |
3 | class NewUserFirstPostTest < ActionController::IntegrationTest |
4 | all_fixtures |
5 | |
6 | ## PLEASE |
7 | ## don't refactor this code - it's me learning integration testing, and I plan |
8 | ## on improving it myself over the next few days / weeks |
9 | |
10 | def test_signup_and_post_edit_and_topic |
11 | go_home |
12 | |
13 | get login_path |
14 | assert_response :success |
15 | assert_template "sessions/new" |
16 | |
17 | get signup_path |
18 | assert_response :success |
19 | assert_template "users/new" |
20 | |
21 | # create an account |
22 | post users_path, :user => { :display_name => "Josh Goebel", :login => "jgoebel", :password => "beast", :password_confirmation => "beast", :email => "josh@dwgsolutions.com" } |
23 | assert_response :redirect |
24 | follow_redirect! |
25 | assert_response :success |
26 | assert_template "sessions/new" |
27 | |
28 | # sign in? |
29 | post sessions_path, :login => 'jgoebel', :password => 'beast' |
30 | assert_response :success # blast! not activated yet! |
31 | |
32 | activate 'jgoebel' |
33 | |
34 | # sign in |
35 | # login("jgoebel","beast") |
36 | |
37 | review_topic(topics(:pdi)) |
38 | first_post=add_reply(topics(:pdi), "I'm on it.") |
39 | click_edit_post(first_post) |
40 | |
41 | # update that post |
42 | post post_path(:forum_id => forums(:rails), :topic_id => topics(:pdi), :id => first_post), :post => { :body => "I change my mind, I'm scared."}, :_method => "put" |
43 | assert_response :redirect |
44 | follow_redirect! |
45 | assert_template "topics/show" |
46 | assert_equal("I change my mind, I'm scared.", first_post.reload.body) |
47 | |
48 | # ponies |
49 | review_topic(topics(:ponies)) |
50 | add_reply(topics(:ponies), "Ponies are cool.") |
51 | |
52 | # post new topic |
53 | post topics_path(:forum_id => forums(:rails).id), :topic => { :title => "Beast rocks!", :body => "I love beast!"} |
54 | assert_response :redirect |
55 | follow_redirect! |
56 | assert_template "topics/show" |
57 | |
58 | # back to home |
59 | go_home |
60 | |
61 | # logoff |
62 | get logout_path |
63 | assert_response :redirect |
64 | follow_redirect! |
65 | assert_template "forums/index" |
66 | |
67 | josh=User.find_by_login "jgoebel" |
68 | assert_equal 3, josh.posts.count |
69 | end |
70 | |
71 | private |
72 | |
73 | # return to / |
74 | def go_home |
75 | get forums_path |
76 | assert_response :success |
77 | assert_template "forums/index" |
78 | end |
79 | |
80 | # adds a reply to a particular post |
81 | def add_reply(topic,body) |
82 | post posts_path(topic.forum, topic), :post => { :body => body } |
83 | assert_response :redirect |
84 | post = assigns(:post) |
85 | follow_redirect! |
86 | assert_response :success |
87 | assert_template "topics/show" |
88 | post |
89 | end |
90 | |
91 | # pulls up the edit form for a post |
92 | def click_edit_post(post) |
93 | get edit_post_path(post.topic.forum, post.topic, post) |
94 | assert_response :success |
95 | assert_template "posts/edit.rhtml" |
96 | end |
97 | |
98 | def login(user, password) |
99 | post sessions_path, :login => user, :password => password |
100 | assert_response :redirect |
101 | follow_redirect! |
102 | assert_response :success |
103 | assert_template "forums/index" |
104 | end |
105 | |
106 | def activate(login) |
107 | user = User.find_by_login login |
108 | get "/activate/#{user.login_key}" |
109 | assert_response :redirect |
110 | follow_redirect! |
111 | assert_response :success |
112 | assert_template "forums/index" |
113 | end |
114 | |
115 | # walks down the tree, index, forum, topic |
116 | def review_topic(topic) |
117 | get forums_path |
118 | assert_response :success |
119 | assert assigns(:forums) |
120 | assert_template "forums/index" |
121 | |
122 | get forum_path(topic.forum) |
123 | assert_response :success |
124 | assert assigns(:forum) |
125 | assert assigns(:topics) |
126 | assert_template "forums/show" |
127 | |
128 | get topic_path(topic.forum, topic) |
129 | assert_response :success |
130 | assert assigns(:topic) |
131 | assert assigns(:posts) |
132 | assert_template "topics/show" |
133 | end |
134 | |
135 | end |