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:
- 2185 Bytes
1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | |
3 | class TopicTest < Test::Unit::TestCase |
4 | all_fixtures |
5 | |
6 | def test_knows_last_post |
7 | assert_equal posts(:pdi_rebuttal), topics(:pdi).posts.last |
8 | end |
9 | |
10 | def test_should_require_title_user_and_forum |
11 | t=Topic.new |
12 | t.valid? |
13 | assert t.errors.on( :title) |
14 | assert t.errors.on( :user) |
15 | assert t.errors.on( :forum) |
16 | assert ! t.save |
17 | t.user=users(:aaron) |
18 | t.title = "happy life" |
19 | t.forum = forums(:rails) |
20 | assert t.save |
21 | assert_nil t.errors.on( :title) |
22 | assert_nil t.errors.on( :user) |
23 | assert_nil t.errors.on( :forum) |
24 | end |
25 | |
26 | def test_should_add_to_user_counter_cache |
27 | assert_difference Post, :count do |
28 | assert_difference users(:sam).posts, :count do |
29 | p = topics(:pdi).posts.build(:body => "I'll do it") |
30 | p.user = users(:sam) |
31 | p.save |
32 | end |
33 | end |
34 | end |
35 | |
36 | def test_should_create_topic |
37 | counts = lambda { [Topic.count, forums(:rails).topics_count] } |
38 | old = counts.call |
39 | t = forums(:rails).topics.build(:title => 'foo') |
40 | t.user = users(:aaron) |
41 | assert_valid t |
42 | t.save |
43 | [forums(:rails), users(:aaron)].each &:reload |
44 | assert_equal old.collect { |n| n + 1}, counts.call |
45 | end |
46 | |
47 | def test_should_delete_topic |
48 | counts = lambda { [Topic.count, Post.count, forums(:rails).topics_count, forums(:rails).posts_count, users(:sam).posts_count] } |
49 | old = counts.call |
50 | topics(:ponies).destroy |
51 | [forums(:rails), users(:sam)].each &:reload |
52 | assert_equal old.collect { |n| n - 1}, counts.call |
53 | end |
54 | |
55 | def test_hits |
56 | hits=topics(:pdi).views |
57 | topics(:pdi).hit! |
58 | topics(:pdi).hit! |
59 | assert_equal(hits+2, topics(:pdi).reload.hits) |
60 | assert_equal(topics(:pdi).hits, topics(:pdi).views) |
61 | end |
62 | |
63 | def test_replied_at_set |
64 | t=Topic.new |
65 | t.user=users(:aaron) |
66 | t.title = "happy life" |
67 | t.forum = forums(:rails) |
68 | assert t.save |
69 | assert_not_nil t.replied_at |
70 | assert t.replied_at <= Time.now.utc |
71 | assert_in_delta t.replied_at, Time.now.utc, 5.seconds |
72 | end |
73 | |
74 | def test_doesnt_change_replied_at_on_save |
75 | t=Topic.find(:first) |
76 | old=t.replied_at |
77 | assert t.save |
78 | assert_equal old, t.replied_at |
79 | end |
80 | |
81 | end |