Renames uploaded_test_file helper.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2909 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
94d34887cc
commit
ac8a67191f
|
@ -75,7 +75,7 @@ class DocumentsControllerTest < ActionController::TestCase
|
||||||
:document => { :title => 'DocumentsControllerTest#test_post_new',
|
:document => { :title => 'DocumentsControllerTest#test_post_new',
|
||||||
:description => 'This is a new document',
|
:description => 'This is a new document',
|
||||||
:category_id => 2},
|
: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'
|
assert_redirected_to 'projects/ecookbook/documents'
|
||||||
|
|
||||||
|
|
|
@ -787,7 +787,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
post :edit,
|
post :edit,
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:notes => '',
|
: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'
|
assert_redirected_to :action => 'show', :id => '1'
|
||||||
j = Issue.find(1).journals.find(:first, :order => 'id DESC')
|
j = Issue.find(1).journals.find(:first, :order => 'id DESC')
|
||||||
assert j.notes.blank?
|
assert j.notes.blank?
|
||||||
|
|
|
@ -272,7 +272,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
assert_difference 'Attachment.count' do
|
assert_difference 'Attachment.count' do
|
||||||
post :add_file, :id => 1, :version_id => '',
|
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
|
end
|
||||||
assert_redirected_to 'projects/ecookbook/files'
|
assert_redirected_to 'projects/ecookbook/files'
|
||||||
a = Attachment.find(:first, :order => 'created_on DESC')
|
a = Attachment.find(:first, :order => 'created_on DESC')
|
||||||
|
@ -303,7 +303,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
assert_difference 'Attachment.count' do
|
assert_difference 'Attachment.count' do
|
||||||
post :add_file, :id => 1, :version_id => '2',
|
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
|
end
|
||||||
assert_redirected_to 'projects/ecookbook/files'
|
assert_redirected_to 'projects/ecookbook/files'
|
||||||
a = Attachment.find(:first, :order => 'created_on DESC')
|
a = Attachment.find(:first, :order => 'created_on DESC')
|
||||||
|
|
|
@ -71,7 +71,7 @@ class IssuesTest < ActionController::IntegrationTest
|
||||||
|
|
||||||
post 'issues/1/edit',
|
post 'issues/1/edit',
|
||||||
:notes => 'Some notes',
|
: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"
|
assert_redirected_to "issues/1"
|
||||||
|
|
||||||
# make sure attachment was saved
|
# make sure attachment was saved
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ActiveSupport::TestCase
|
||||||
assert_equal login, User.find(session[:user_id]).login
|
assert_equal login, User.find(session[:user_id]).login
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_uploaded_file(name, mime)
|
def uploaded_test_file(name, mime)
|
||||||
ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime)
|
ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,14 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def test_create
|
def test_create
|
||||||
a = Attachment.new(:container => Issue.find(1),
|
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))
|
:author => User.find(1))
|
||||||
assert a.save
|
assert a.save
|
||||||
assert_equal 'testfile.txt', a.filename
|
assert_equal 'testfile.txt', a.filename
|
||||||
assert_equal 59, a.filesize
|
assert_equal 59, a.filesize
|
||||||
assert_equal 'text/plain', a.content_type
|
assert_equal 'text/plain', a.content_type
|
||||||
assert_equal 0, a.downloads
|
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)
|
assert File.exist?(a.diskfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue