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:
parent
78e7ceb347
commit
3e199600ec
5 changed files with 11 additions and 11 deletions
|
@ -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
|
|
7
app/jobs/action_mailroom/routing_job.rb
Normal file
7
app/jobs/action_mailroom/routing_job.rb
Normal 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
|
|
@ -18,6 +18,6 @@ class ActionMailroom::InboundEmail < ActiveRecord::Base
|
||||||
|
|
||||||
private
|
private
|
||||||
def deliver_to_mailroom_later
|
def deliver_to_mailroom_later
|
||||||
ActionMailroom::DeliverInboundEmailToMailroomJob.perform_later self
|
ActionMailroom::RoutingJob.perform_later self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require_relative '../../test_helper'
|
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
|
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)
|
create_inbound_email("welcome.eml", status: :pending)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -22,7 +22,7 @@ class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "delayed routing" do
|
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)
|
another_inbound_email = create_inbound_email("welcome.eml", status: :pending)
|
||||||
assert_equal "Discussion: Let's debate these attachments", $processed
|
assert_equal "Discussion: Let's debate these attachments", $processed
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue