mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-12 18:34:22 +01:00
change message gateway to save received email as attachment to the todo
This commit is contained in:
parent
76de5bf2b3
commit
4d7c453ca7
4 changed files with 51 additions and 2 deletions
|
|
@ -83,4 +83,22 @@ class MessageGatewayTest < ActiveSupport::TestCase
|
|||
assert_not_nil(invalid_context_todo)
|
||||
assert_equal(@inbox, invalid_context_todo.context)
|
||||
end
|
||||
|
||||
def test_receiving_email_adds_attachment
|
||||
attachment_count = Attachment.count
|
||||
|
||||
load_message('sample_mms.txt')
|
||||
|
||||
message_todo = Todo.where(:description => "This is the subject").first
|
||||
assert_not_nil(message_todo)
|
||||
|
||||
assert_equal attachment_count+1, Attachment.count
|
||||
assert_equal 1,message_todo.attachments.count
|
||||
|
||||
orig = File.read(File.join(Rails.root, 'test', 'fixtures', 'sample_mms.txt'))
|
||||
attachment = File.read(message_todo.attachments.first.file.path)
|
||||
|
||||
assert_equal orig, attachment
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue