@@ -60,6 +60,10 class Version < ActiveRecord::Base | |||||
60 | project.present? && project.attachments_visible?(*args) |
|
60 | project.present? && project.attachments_visible?(*args) | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
|
63 | def attachments_deletable?(usr=User.current) | |||
|
64 | project.present? && project.attachments_deletable?(usr) | |||
|
65 | end | |||
|
66 | ||||
63 | def start_date |
|
67 | def start_date | |
64 | @start_date ||= fixed_issues.minimum('start_date') |
|
68 | @start_date ||= fixed_issues.minimum('start_date') | |
65 | end |
|
69 | end |
@@ -387,6 +387,16 class AttachmentsControllerTest < ActionController::TestCase | |||||
387 | end |
|
387 | end | |
388 | end |
|
388 | end | |
389 |
|
389 | |||
|
390 | def test_destroy_version_attachment_with_issue_tracking_disabled | |||
|
391 | Project.find(1).disable_module! :issue_tracking | |||
|
392 | set_tmp_attachments_directory | |||
|
393 | @request.session[:user_id] = 2 | |||
|
394 | assert_difference 'Attachment.count', -1 do | |||
|
395 | delete :destroy, :id => 9 | |||
|
396 | assert_response 302 | |||
|
397 | end | |||
|
398 | end | |||
|
399 | ||||
390 | def test_destroy_without_permission |
|
400 | def test_destroy_without_permission | |
391 | set_tmp_attachments_directory |
|
401 | set_tmp_attachments_directory | |
392 | assert_no_difference 'Attachment.count' do |
|
402 | assert_no_difference 'Attachment.count' do |
General Comments 0
You need to be logged in to leave comments.
Login now