diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-15 21:08:27 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-15 21:08:27 +0000 |
commit | 93e0885b64d82b42e028f68ad6f8e15dede7c781 (patch) | |
tree | e248fe9d1b671f50f21a35f2fb3ab0d7e313e483 /test/object_helpers.rb | |
parent | 48c3785991f789f34171dfd687b30664c8915a73 (diff) | |
download | redmine-93e0885b64d82b42e028f68ad6f8e15dede7c781.tar.gz redmine-93e0885b64d82b42e028f68ad6f8e15dede7c781.zip |
Link to attachment should return latest attachment (#7510).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11196 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/object_helpers.rb')
-rw-r--r-- | test/object_helpers.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/object_helpers.rb b/test/object_helpers.rb index 254b6040e..4b5fbdbbe 100644 --- a/test/object_helpers.rb +++ b/test/object_helpers.rb @@ -129,4 +129,16 @@ module ObjectHelpers board.save! board end + + def Attachment.generate!(attributes={}) + @generated_filename ||= 'testfile0' + @generated_filename.succ! + attributes = attributes.dup + attachment = Attachment.new(attributes) + attachment.container ||= Issue.find(1) + attachment.author ||= User.find(2) + attachment.filename = @generated_filename if attachment.filename.blank? + attachment.save! + attachment + end end |