summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-03-26 11:05:20 +0000
committerGo MAEDA <maeda@farend.jp>2019-03-26 11:05:20 +0000
commitf0d579adebfe3c5da93135fbaa3d9ec503d06855 (patch)
tree68bc39cd66177ff0c711384335019f42f66f95cf /test
parent391c069d87588dfccda7b308c1a4c808611a3b65 (diff)
downloadredmine-f0d579adebfe3c5da93135fbaa3d9ec503d06855.tar.gz
redmine-f0d579adebfe3c5da93135fbaa3d9ec503d06855.zip
Fix that deleting a version silently deletes its attachments (#31087).
Patch by Karel Pičman and Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@18008 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/version_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb
index 9773a956d..046e20d07 100644
--- a/test/unit/version_test.rb
+++ b/test/unit/version_test.rb
@@ -284,6 +284,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')