Commit d91aee33 authored by jplang's avatar jplang
Browse files

Renames uploaded_test_file helper.

git-svn-id: https://svn.redmine.org/redmine/trunk@2909 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 88ea122f
......@@ -75,7 +75,7 @@ class DocumentsControllerTest < ActionController::TestCase
:document => { :title => 'DocumentsControllerTest#test_post_new',
:description => 'This is a new document',
:category_id => 2},
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
assert_redirected_to 'projects/ecookbook/documents'
......
......@@ -787,7 +787,7 @@ class IssuesControllerTest < ActionController::TestCase
post :edit,
:id => 1,
:notes => '',
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
assert_redirected_to :action => 'show', :id => '1'
j = Issue.find(1).journals.find(:first, :order => 'id DESC')
assert j.notes.blank?
......
......@@ -272,7 +272,7 @@ class ProjectsControllerTest < ActionController::TestCase
assert_difference 'Attachment.count' do
post :add_file, :id => 1, :version_id => '',
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
end
assert_redirected_to 'projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC')
......@@ -303,7 +303,7 @@ class ProjectsControllerTest < ActionController::TestCase
assert_difference 'Attachment.count' do
post :add_file, :id => 1, :version_id => '2',
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
end
assert_redirected_to 'projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC')
......
......@@ -71,7 +71,7 @@ class IssuesTest < ActionController::IntegrationTest
post 'issues/1/edit',
:notes => 'Some notes',
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
assert_redirected_to "issues/1"
# make sure attachment was saved
......
......@@ -54,7 +54,7 @@ class ActiveSupport::TestCase
assert_equal login, User.find(session[:user_id]).login
end
def test_uploaded_file(name, mime)
def uploaded_test_file(name, mime)
ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime)
end
......
......@@ -25,14 +25,14 @@ class AttachmentTest < ActiveSupport::TestCase
def test_create
a = Attachment.new(:container => Issue.find(1),
:file => test_uploaded_file("testfile.txt", "text/plain"),
:file => uploaded_test_file("testfile.txt", "text/plain"),
:author => User.find(1))
assert a.save
assert_equal 'testfile.txt', a.filename
assert_equal 59, a.filesize
assert_equal 'text/plain', a.content_type
assert_equal 0, a.downloads
assert_equal Digest::MD5.hexdigest(test_uploaded_file("testfile.txt", "text/plain").read), a.digest
assert_equal Digest::MD5.hexdigest(uploaded_test_file("testfile.txt", "text/plain").read), a.digest
assert File.exist?(a.diskfile)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment