@@ -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 |
@@ -374,6 +374,16 class AttachmentsControllerTest < ActionController::TestCase | |||||
374 | end |
|
374 | end | |
375 | end |
|
375 | end | |
376 |
|
376 | |||
|
377 | def test_destroy_version_attachment_with_issue_tracking_disabled | |||
|
378 | Project.find(1).disable_module! :issue_tracking | |||
|
379 | set_tmp_attachments_directory | |||
|
380 | @request.session[:user_id] = 2 | |||
|
381 | assert_difference 'Attachment.count', -1 do | |||
|
382 | delete :destroy, :id => 9 | |||
|
383 | assert_response 302 | |||
|
384 | end | |||
|
385 | end | |||
|
386 | ||||
377 | def test_destroy_without_permission |
|
387 | def test_destroy_without_permission | |
378 | set_tmp_attachments_directory |
|
388 | set_tmp_attachments_directory | |
379 | assert_no_difference 'Attachment.count' do |
|
389 | assert_no_difference 'Attachment.count' do |
General Comments 0
You need to be logged in to leave comments.
Login now