##// END OF EJS Templates
remove trailing white-spaces from unit attachment test....
Toshi MARUYAMA -
r5724:b2670f465000
parent child
Show More
@@ -1,18 +1,18
1 # encoding: utf-8
1 # encoding: utf-8
2 #
2 #
3 # redMine - project management software
3 # Redmine - project management software
4 # Copyright (C) 2006-2007 Jean-Philippe Lang
4 # Copyright (C) 2006-2011 Jean-Philippe Lang
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
9 # of the License, or (at your option) any later version.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -21,7 +21,7 require File.expand_path('../../test_helper', __FILE__)
21
21
22 class AttachmentTest < ActiveSupport::TestCase
22 class AttachmentTest < ActiveSupport::TestCase
23 fixtures :issues, :users
23 fixtures :issues, :users
24
24
25 def setup
25 def setup
26 end
26 end
27
27
@@ -37,7 +37,7 class AttachmentTest < ActiveSupport::TestCase
37 assert_equal '1478adae0d4eb06d35897518540e25d6', a.digest
37 assert_equal '1478adae0d4eb06d35897518540e25d6', a.digest
38 assert File.exist?(a.diskfile)
38 assert File.exist?(a.diskfile)
39 end
39 end
40
40
41 def test_create_should_auto_assign_content_type
41 def test_create_should_auto_assign_content_type
42 a = Attachment.new(:container => Issue.find(1),
42 a = Attachment.new(:container => Issue.find(1),
43 :file => uploaded_test_file("testfile.txt", ""),
43 :file => uploaded_test_file("testfile.txt", ""),
@@ -45,7 +45,7 class AttachmentTest < ActiveSupport::TestCase
45 assert a.save
45 assert a.save
46 assert_equal 'text/plain', a.content_type
46 assert_equal 'text/plain', a.content_type
47 end
47 end
48
48
49 def test_identical_attachments_at_the_same_time_should_not_overwrite
49 def test_identical_attachments_at_the_same_time_should_not_overwrite
50 a1 = Attachment.create!(:container => Issue.find(1),
50 a1 = Attachment.create!(:container => Issue.find(1),
51 :file => uploaded_test_file("testfile.txt", ""),
51 :file => uploaded_test_file("testfile.txt", ""),
@@ -55,7 +55,7 class AttachmentTest < ActiveSupport::TestCase
55 :author => User.find(1))
55 :author => User.find(1))
56 assert a1.disk_filename != a2.disk_filename
56 assert a1.disk_filename != a2.disk_filename
57 end
57 end
58
58
59 def test_diskfilename
59 def test_diskfilename
60 assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
60 assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
61 assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1]
61 assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1]
General Comments 0
You need to be logged in to leave comments. Login now