From da697e84445f8f750b8a7d0fa916f429eda8aae4 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 19 Sep 2018 15:52:16 -0700 Subject: Attach a concrete router to the root mailbox and use it Don't think this is how it's going to stay. Doesn't feel like the right place for it. --- test/unit/mailbox/routing_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/unit/mailbox/routing_test.rb (limited to 'test/unit/mailbox') diff --git a/test/unit/mailbox/routing_test.rb b/test/unit/mailbox/routing_test.rb new file mode 100644 index 0000000000..bdb670e956 --- /dev/null +++ b/test/unit/mailbox/routing_test.rb @@ -0,0 +1,23 @@ +require_relative '../../test_helper' + +class ApplicationMailbox < ActionMailroom::Mailbox + routing "replies@example.com" => :replies +end + +class RepliesMailbox < ActionMailroom::Mailbox + def process + $processed = mail.subject + end +end + +class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase + setup do + $processed = false + @inbound_email = create_inbound_email("welcome.eml") + end + + test "string routing" do + ApplicationMailbox.route @inbound_email + assert_equal "Discussion: Let's debate these attachments", $processed + end +end -- cgit v1.2.3