diff options
author | Go MAEDA <maeda@farend.jp> | 2019-03-26 14:41:30 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-03-26 14:41:30 +0000 |
commit | ed8bf602b2689cced97d1033f9f64a1ca23b1bd2 (patch) | |
tree | cbf9637ac9f7bfd13caf610f09fc2079185f72b0 | |
parent | e7cbfb012be16ef4b81bbc0c1166e77fa5aa6cd9 (diff) | |
download | redmine-ed8bf602b2689cced97d1033f9f64a1ca23b1bd2.tar.gz redmine-ed8bf602b2689cced97d1033f9f64a1ca23b1bd2.zip |
Merged r18008 from trunk to 3.4-stable (#31087).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@18010 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/version.rb | 2 | ||||
-rw-r--r-- | test/unit/version_test.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index a213359f6..ee1d3daf0 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -268,7 +268,7 @@ class Version < ActiveRecord::Base end def deletable? - fixed_issues.empty? && !referenced_by_a_custom_field? + fixed_issues.empty? && !referenced_by_a_custom_field? && attachments.empty? end def default_project_version diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb index 40014375a..0f24f8e60 100644 --- a/test/unit/version_test.rb +++ b/test/unit/version_test.rb @@ -277,6 +277,13 @@ class VersionTest < ActiveSupport::TestCase assert_equal false, version.deletable? end + def test_deletable_should_return_false_when_referenced_by_an_attachment + version = Version.generate! + Attachment.generate!(:container => version, :filename => 'test.txt') + + assert_equal false, version.deletable? + end + def test_like_scope version = Version.create!(:project => Project.find(1), :name => 'Version for like scope test') |