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:
- 2476 Bytes
1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | |
3 | class PostTest < Test::Unit::TestCase |
4 | all_fixtures |
5 | |
6 | def test_should_select_posts |
7 | assert_equal [posts(:pdi), posts(:pdi_reply), posts(:pdi_rebuttal)], topics(:pdi).posts |
8 | end |
9 | |
10 | def test_should_find_topic |
11 | assert_equal topics(:pdi), posts(:pdi_reply).topic |
12 | end |
13 | |
14 | def test_should_require_body_for_post |
15 | p = topics(:pdi).posts.build |
16 | p.valid? |
17 | assert p.errors.on(:body) |
18 | end |
19 | |
20 | def test_should_create_reply |
21 | counts = lambda { [Post.count, forums(:rails).posts_count, users(:aaron).posts_count, topics(:pdi).posts_count] } |
22 | equal = lambda { [forums(:rails).topics_count] } |
23 | old_counts = counts.call |
24 | old_equal = equal.call |
25 | |
26 | p = create_post topics(:pdi), :body => 'blah' |
27 | assert_valid p |
28 | |
29 | [forums(:rails), users(:aaron), topics(:pdi)].each &:reload |
30 | |
31 | assert_equal old_counts.collect { |n| n + 1}, counts.call |
32 | assert_equal old_equal, equal.call |
33 | end |
34 | |
35 | def test_should_update_cached_data |
36 | p = create_post topics(:pdi), :body => 'ok, ill get right on it' |
37 | assert_valid p |
38 | topics(:pdi).reload |
39 | assert_equal p.id, topics(:pdi).last_post_id |
40 | assert_equal p.user_id, topics(:pdi).replied_by |
41 | assert_equal p.created_at.to_i, topics(:pdi).replied_at.to_i |
42 | end |
43 | |
44 | def test_should_create_reply_and_set_forum_from_topic |
45 | p = create_post topics(:pdi), :body => 'blah' |
46 | assert_equal topics(:pdi).forum_id, p.forum_id |
47 | end |
48 | |
49 | def test_should_delete_reply |
50 | counts = lambda { [Post.count, forums(:rails).posts_count, users(:sam).posts_count, topics(:pdi).posts_count] } |
51 | equal = lambda { [forums(:rails).topics_count] } |
52 | old_counts = counts.call |
53 | old_equal = equal.call |
54 | posts(:pdi_reply).destroy |
55 | [forums(:rails), users(:sam), topics(:pdi)].each &:reload |
56 | assert_equal old_counts.collect { |n| n - 1}, counts.call |
57 | assert_equal old_equal, equal.call |
58 | end |
59 | |
60 | def test_should_edit_own_post |
61 | assert posts(:shield).editable_by?(users(:sam)) |
62 | end |
63 | |
64 | def test_should_edit_post_as_admin |
65 | assert posts(:shield).editable_by?(users(:aaron)) |
66 | end |
67 | |
68 | def test_should_edit_post_as_moderator |
69 | assert posts(:pdi).editable_by?(users(:sam)) |
70 | end |
71 | |
72 | def test_should_not_edit_post_in_own_topic |
73 | assert !posts(:shield_reply).editable_by?(users(:sam)) |
74 | end |
75 | |
76 | protected |
77 | def create_post(topic, options = {}) |
78 | returning topic.posts.build(options) do |p| |
79 | p.user = users(:aaron) |
80 | p.save |
81 | end |
82 | end |
83 | end |