@@ -2,7 +2,7 require File.expand_path('../../test_helper', __FILE__) | |||
|
2 | 2 | |
|
3 | 3 | class FilesControllerTest < ActionController::TestCase |
|
4 | 4 | fixtures :all |
|
5 | ||
|
5 | ||
|
6 | 6 | def setup |
|
7 | 7 | @controller = FilesController.new |
|
8 | 8 | @request = ActionController::TestRequest.new |
@@ -16,11 +16,11 class FilesControllerTest < ActionController::TestCase | |||
|
16 | 16 | assert_response :success |
|
17 | 17 | assert_template 'index' |
|
18 | 18 | assert_not_nil assigns(:containers) |
|
19 | ||
|
19 | ||
|
20 | 20 | # file attached to the project |
|
21 | 21 | assert_tag :a, :content => 'project_file.zip', |
|
22 | 22 | :attributes => { :href => '/attachments/download/8/project_file.zip' } |
|
23 | ||
|
23 | ||
|
24 | 24 | # file attached to a project's version |
|
25 | 25 | assert_tag :a, :content => 'version_file.zip', |
|
26 | 26 | :attributes => { :href => '/attachments/download/9/version_file.zip' } |
@@ -31,7 +31,7 class FilesControllerTest < ActionController::TestCase | |||
|
31 | 31 | @request.session[:user_id] = 2 |
|
32 | 32 | Setting.notified_events = ['file_added'] |
|
33 | 33 | ActionMailer::Base.deliveries.clear |
|
34 | ||
|
34 | ||
|
35 | 35 | assert_difference 'Attachment.count' do |
|
36 | 36 | post :create, :project_id => 1, :version_id => '', |
|
37 | 37 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
@@ -47,12 +47,12 class FilesControllerTest < ActionController::TestCase | |||
|
47 | 47 | assert_equal "[eCookbook] New file", mail.subject |
|
48 | 48 | assert mail.body.include?('testfile.txt') |
|
49 | 49 | end |
|
50 | ||
|
50 | ||
|
51 | 51 | def test_create_version_file |
|
52 | 52 | set_tmp_attachments_directory |
|
53 | 53 | @request.session[:user_id] = 2 |
|
54 | 54 | Setting.notified_events = ['file_added'] |
|
55 | ||
|
55 | ||
|
56 | 56 | assert_difference 'Attachment.count' do |
|
57 | 57 | post :create, :project_id => 1, :version_id => '2', |
|
58 | 58 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
@@ -63,5 +63,5 class FilesControllerTest < ActionController::TestCase | |||
|
63 | 63 | assert_equal 'testfile.txt', a.filename |
|
64 | 64 | assert_equal Version.find(2), a.container |
|
65 | 65 | end |
|
66 | ||
|
66 | ||
|
67 | 67 | end |
General Comments 0
You need to be logged in to leave comments.
Login now