Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
fb595ec7
Commit
fb595ec7
authored
Jan 31, 2012
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#775] Don't create a new journal on Attachment#increment_download
parent
11b441f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
attachment.rb
app/models/attachment.rb
+2
-1
attachment_test.rb
test/unit/attachment_test.rb
+21
-1
No files found.
app/models/attachment.rb
View file @
fb595ec7
...
...
@@ -34,7 +34,8 @@ class Attachment < ActiveRecord::Base
end
),
:activity_type
=>
'files'
,
:activity_permission
=>
:view_files
,
:activity_find_options
=>
{
:include
=>
{
:version
=>
:project
}
}
:activity_find_options
=>
{
:include
=>
{
:version
=>
:project
}
},
:except
=>
[
:downloads
]
acts_as_activity
:type
=>
'documents'
,
:permission
=>
:view_documents
,
:find_options
=>
{
:include
=>
{
:document
=>
:project
}
}
...
...
test/unit/attachment_test.rb
View file @
fb595ec7
...
...
@@ -14,7 +14,7 @@
require
File
.
expand_path
(
'../../test_helper'
,
__FILE__
)
class
AttachmentTest
<
ActiveSupport
::
TestCase
fixtures
:issues
,
:
us
ers
fixtures
:issues
,
:
projects
,
:users
,
:issue_statuses
,
:trackers
,
:projects_track
ers
def
setup
end
...
...
@@ -76,4 +76,24 @@ class AttachmentTest < ActiveSupport::TestCase
end
end
end
context
"Attachment#increment_download"
do
should
"not create a journal entry"
do
issue
=
Issue
.
generate!
(
:status_id
=>
1
,
:tracker_id
=>
1
,
:project_id
=>
1
)
attachment
=
Attachment
.
create!
(
:container
=>
issue
,
:file
=>
mock_file
,
:author
=>
User
.
find
(
1
))
assert_equal
0
,
attachment
.
downloads
# just the initial journal
assert_equal
1
,
attachment
.
journals
.
count
attachment
.
reload
attachment
.
increment_download
assert_equal
1
,
attachment
.
downloads
# no added journal
assert_equal
1
,
attachment
.
journals
.
count
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment