1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Routing is a named concept now

This commit is contained in:
David Heinemeier Hansson 2018-09-19 16:38:33 -07:00
parent 78e7ceb347
commit 3e199600ec
5 changed files with 11 additions and 11 deletions

View file

@ -1,7 +0,0 @@
class ActionMailroom::DeliverInboundEmailToMailroomJob < ActiveJob::Base
queue_as :action_mailroom_inbound_email
def perform(inbound_email)
ApplicationMailbox.route inbound_email
end
end

View file

@ -0,0 +1,7 @@
class ActionMailroom::RoutingJob < ActiveJob::Base
queue_as :action_mailroom_routing
def perform(inbound_email)
ApplicationMailbox.route inbound_email
end
end

View file

@ -18,6 +18,6 @@ class ActionMailroom::InboundEmail < ActiveRecord::Base
private
def deliver_to_mailroom_later
ActionMailroom::DeliverInboundEmailToMailroomJob.perform_later self
ActionMailroom::RoutingJob.perform_later self
end
end

View file

@ -1,8 +1,8 @@
require_relative '../../test_helper'
class ActionMailroom::InboundEmail::DeliverToMailroomTest < ActiveSupport::TestCase
class ActionMailroom::InboundEmail::RoutingTest < ActiveSupport::TestCase
test "pending emails are delivered to the mailroom" do
assert_enqueued_jobs 1, only: ActionMailroom::DeliverInboundEmailToMailroomJob do
assert_enqueued_jobs 1, only: ActionMailroom::RoutingJob do
create_inbound_email("welcome.eml", status: :pending)
end
end

View file

@ -22,7 +22,7 @@ class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase
end
test "delayed routing" do
perform_enqueued_jobs only: ActionMailroom::DeliverInboundEmailToMailroomJob do
perform_enqueued_jobs only: ActionMailroom::RoutingJob do
another_inbound_email = create_inbound_email("welcome.eml", status: :pending)
assert_equal "Discussion: Let's debate these attachments", $processed
end