aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-12-13 16:01:16 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-12-13 16:01:16 -0800
commit2746449085135e6c345b393b0603eea4a7b1a1b4 (patch)
tree07c0cee6c3ff84b964244bd85d122ec63dca4e9b /README.md
parente94864446a57d632214d606b231d58f0c6205d75 (diff)
downloadrails-2746449085135e6c345b393b0603eea4a7b1a1b4.tar.gz
rails-2746449085135e6c345b393b0603eea4a7b1a1b4.tar.bz2
rails-2746449085135e6c345b393b0603eea4a7b1a1b4.zip
Tidy up and example testing
Diffstat (limited to 'README.md')
-rw-r--r--README.md30
1 files changed, 27 insertions, 3 deletions
diff --git a/README.md b/README.md
index dfa2ee5431..33136d47db 100644
--- a/README.md
+++ b/README.md
@@ -230,19 +230,43 @@ end
## Incineration of InboundEmails
-By default, an InboundEmail that has been marked as successfully processed will be incinerated after 30 days. This ensures you're not holding on to people's data willy-nilly after they may have canceled their accounts or deleted their content. The intention is that after you've processed an email, you should have extracted all the data you needed and turned it into domain models and content on your side of the application. The InboundEmail simply stays in the system for the extra time to provide debugging and forensics options.
+By default, an InboundEmail that has been successfully processed will be incinerated after 30 days. This ensures you're not holding on to people's data willy-nilly after they may have canceled their accounts or deleted their content. The intention is that after you've processed an email, you should have extracted all the data you needed and turned it into domain models and content on your side of the application. The InboundEmail simply stays in the system for the extra time to provide debugging and forensics options.
The actual incineration is done via the `IncinerationJob` that's scheduled to run after `config.action_mailbox.incinerate_after` time. This value is by default set to `30.days`, but you can change it in your production.rb configuration. (Note that this far-future incineration scheduling relies on your job queue being able to hold jobs for that long.)
-## Create incoming email through a conductor module in development
+## Working with Action Mailbox in development
It's helpful to be able to test incoming emails in development without actually sending and receiving real emails. To accomplish this, there's a conductor controller mounted at `/rails/conductor/action_mailbox/inbound_emails`, which gives you an index of all the InboundEmails in the system, their state of processing, and a form to create a new InboundEmail as well.
## Testing mailboxes
-TODO
+Example:
+
+```ruby
+class ForwardsMailboxTest < ActionMailbox::TestCase
+ test "directly recording a client forward for a forwarder and forwardee corresponding to one project" do
+ assert_difference -> { people(:david).buckets.first.recordings.count } do
+ receive_inbound_email_from_mail \
+ to: 'save@example.com',
+ from: people(:david).email_address,
+ subject: "Fwd: Status update?",
+ body: <<~BODY
+ --- Begin forwarded message ---
+ From: Frank Holland <frank@microsoft.com>
+
+ What's the status?
+ BODY
+ end
+
+ recording = people(:david).buckets.first.recordings.last
+ assert_equal people(:david), recording.creator
+ assert_equal "Status update?", recording.forward.subject
+ assert_match "What's the status?", recording.forward.content.to_s
+ end
+end
+```
## Development road map