Merged ajax_upload branch (#3957).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10977 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -223,12 +223,21 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_file_without_container_should_be_denied
|
||||
def test_show_file_without_container_should_be_allowed_to_author
|
||||
set_tmp_attachments_directory
|
||||
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
|
||||
|
||||
@request.session[:user_id] = 2
|
||||
get :show, :id => attachment.id
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
def test_show_file_without_container_should_be_allowed_to_author
|
||||
set_tmp_attachments_directory
|
||||
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
|
||||
|
||||
@request.session[:user_id] = 3
|
||||
get :show, :id => attachment.id
|
||||
assert_response 403
|
||||
end
|
||||
|
||||
|
||||
@@ -1000,7 +1000,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
get :show, :id => 1
|
||||
|
||||
assert_select 'form#issue-form[method=post][enctype=multipart/form-data]' do
|
||||
assert_select 'input[type=file][name=?]', 'attachments[1][file]'
|
||||
assert_select 'input[type=file][name=?]', 'attachments_files'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1569,8 +1569,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
get :new, :project_id => 1, :tracker_id => 1
|
||||
|
||||
assert_select 'form[id=issue-form][method=post][enctype=multipart/form-data]' do
|
||||
assert_select 'input[name=?][type=file]', 'attachments[1][file]'
|
||||
assert_select 'input[name=?][maxlength=255]', 'attachments[1][description]'
|
||||
assert_select 'input[name=?][type=file]', 'attachments_files'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2165,7 +2164,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_nil attachment.container
|
||||
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
|
||||
assert_tag 'span', :content => /testfile.txt/
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'}
|
||||
end
|
||||
|
||||
def test_post_create_with_failure_should_keep_saved_attachments
|
||||
@@ -2184,7 +2183,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
|
||||
assert_tag 'span', :content => /testfile.txt/
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'}
|
||||
end
|
||||
|
||||
def test_post_create_should_attach_saved_attachments
|
||||
@@ -2967,7 +2966,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_nil attachment.container
|
||||
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
|
||||
assert_tag 'span', :content => /testfile.txt/
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'}
|
||||
end
|
||||
|
||||
def test_put_update_with_failure_should_keep_saved_attachments
|
||||
@@ -2986,7 +2985,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
|
||||
assert_tag 'span', :content => /testfile.txt/
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'}
|
||||
end
|
||||
|
||||
def test_put_update_should_attach_saved_attachments
|
||||
|
||||
@@ -104,7 +104,7 @@ class IssuesControllerTransactionTest < ActionController::TestCase
|
||||
assert_template 'edit'
|
||||
attachment = Attachment.first(:order => 'id DESC')
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
|
||||
assert_tag 'span', :content => /testfile.txt/
|
||||
assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'}
|
||||
end
|
||||
|
||||
def test_update_stale_issue_without_notes_should_not_show_add_notes_option
|
||||
|
||||
Reference in New Issue
Block a user