comparison test/unit/.svn/text-base/attachment_test.rb.svn-base @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 513646585e45
children cd2282d2aa55 cbce1fd3b1b7
comparison
equal deleted inserted replaced
39:150ceac17a8d 119:8661b858af72
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.
19 19
20 require File.dirname(__FILE__) + '/../test_helper' 20 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
32 assert a.save 32 assert a.save
33 assert_equal 'testfile.txt', a.filename 33 assert_equal 'testfile.txt', a.filename
34 assert_equal 59, a.filesize 34 assert_equal 59, a.filesize
35 assert_equal 'text/plain', a.content_type 35 assert_equal 'text/plain', a.content_type
36 assert_equal 0, a.downloads 36 assert_equal 0, a.downloads
37 assert_equal Digest::MD5.hexdigest(uploaded_test_file("testfile.txt", "text/plain").read), 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),