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