Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 1301 Bytes
1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | |
3 | require 'content' |
4 | require 'article' |
5 | |
6 | # Assumptions test? What's that then? |
7 | # |
8 | # Here's where we test assumptions about way Rails behaves that we |
9 | # rely on in the codebase. That way, if the Rails behaviour changes, |
10 | # we can catch the underlying cause here, which can save a good deal |
11 | # of bug chasing. |
12 | |
13 | class Article |
14 | def got_saved |
15 | @saved |
16 | end |
17 | |
18 | protected |
19 | |
20 | before_save :set_saved_var |
21 | |
22 | def set_saved_var |
23 | @saved = true |
24 | end |
25 | end |
26 | |
27 | class AssumptionsTest < Test::Unit::TestCase |
28 | |
29 | # This only works in the case where the article caches the comment |
30 | # counter. Because the counter_cache is 'invisible' to the model, it |
31 | # could be argued that incrementing it shouldn't go triggering the |
32 | # 'visible' save/update/whatever hooks in Activerecord. (Which would |
33 | # be a shame, because we rely on it). So, we'll continue to check |
34 | # that Rails does what we expect. |
35 | |
36 | def test_adding_a_comment_saves_the_article |
37 | a = Article.new(:title => 'A title', :body => 'Some body') |
38 | |
39 | assert !a.got_saved |
40 | assert a.save |
41 | assert a.got_saved |
42 | |
43 | a = nil |
44 | |
45 | a = Article.find(:first) |
46 | |
47 | assert !a.got_saved |
48 | |
49 | c = Comment.new( :author => 'Piers Cawley', :body => 'A boring comment') |
50 | |
51 | a.comments << c |
52 | assert a.got_saved |
53 | end |
54 | end |