Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 10
- Log:
Checking in HEAD from RForum's SVN of 22-Jul-2006, 8pm (revision 906).
- Author:
- adh
- Date:
- Sat Jul 22 20:02:44 +0100 2006
- Size:
- 965 Bytes
- Properties:
- Property svn:executable is set
1 | #!/bin/env ruby |
2 | |
3 | require File.dirname(__FILE__) + '/../test_helper' |
4 | |
5 | class AttachmentTest < Test::Unit::TestCase |
6 | |
7 | fixtures 'attachments', 'posts' |
8 | |
9 | def teardown |
10 | Dir[RAILS_ROOT + RForum::CONFIG[:attachment_path] + '/*'].each do |d| |
11 | Dir[d + '/*'].each do |f| |
12 | File.delete f |
13 | end |
14 | Dir.delete d |
15 | end |
16 | end |
17 | |
18 | def create_attachment |
19 | a = Attachment.new |
20 | a.data = 'some data' |
21 | a.filename = '../../data.txt' |
22 | a.save |
23 | a |
24 | end |
25 | |
26 | def test_create |
27 | a = create_attachment |
28 | |
29 | assert_equal '__.._data.txt', a.filename |
30 | assert_equal 'some data', File.read(a.file_path) |
31 | end |
32 | |
33 | def test_destroy |
34 | a = create_attachment |
35 | p = Post.find(1) |
36 | p.attachments << a |
37 | |
38 | a.destroy |
39 | assert_raises(Errno::ENOENT) { File.stat(a.dir_path) } |
40 | end |
41 | |
42 | def test_post_destroy |
43 | a = create_attachment |
44 | p = Post.find(1) |
45 | p.attachments << a |
46 | |
47 | p.destroy |
48 | assert_raises(Errno::ENOENT) { File.stat(a.dir_path) } |
49 | end |
50 | |
51 | end |