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
1d3cdf1f
Commit
1d3cdf1f
authored
May 18, 2012
by
Felix Schäfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct email sending on attachment to document #1008
parent
3e84c481
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
documents_controller.rb
app/controllers/documents_controller.rb
+1
-1
documents_controller_test.rb
test/functional/documents_controller_test.rb
+22
-0
No files found.
app/controllers/documents_controller.rb
View file @
1d3cdf1f
...
...
@@ -85,7 +85,7 @@ class DocumentsController < ApplicationController
if
attachments
.
present?
&&
attachments
[
:files
].
present?
&&
Setting
.
notified_events
.
include?
(
'document_added'
)
# TODO: refactor
attachments
.
first
.
container
.
recipients
.
each
do
|
recipient
|
@document
.
recipients
.
each
do
|
recipient
|
Mailer
.
deliver_attachments_added
(
attachments
[
:files
],
recipient
)
end
end
...
...
test/functional/documents_controller_test.rb
View file @
1d3cdf1f
...
...
@@ -147,6 +147,28 @@ LOREM
end
end
context
"#add_attachment"
do
setup
do
@request
.
session
[
:user_id
]
=
2
set_tmp_attachments_directory
@document
=
Document
.
generate!
(
:project
=>
Project
.
find
(
'ecookbook'
),
:title
=>
'Test'
)
end
should
"send a notification mail"
do
ActionMailer
::
Base
.
deliveries
.
clear
Setting
.
notified_events
=
Setting
.
notified_events
.
dup
<<
'document_added'
post
:add_attachment
,
:id
=>
@document
.
id
,
:attachments
=>
{
'1'
=>
{
'file'
=>
uploaded_test_file
(
'testfile.txt'
,
'text/plain'
)}}
@document
.
reload
assert_not_nil
@document
assert_equal
2
,
ActionMailer
::
Base
.
deliveries
.
size
end
end
def
test_destroy
@request
.
session
[
:user_id
]
=
2
post
:destroy
,
:id
=>
1
...
...
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