aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-09-19 17:08:35 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-09-19 17:08:35 -0700
commita166c21a49ddb5e9cca7ecde7cbb671f14a56fef (patch)
tree2ea762de9d69dcf2e1dac751e6163fff1a3d5953 /test
parent8cd299286e9dd0c61731fe2d23f316c74d60b6bf (diff)
downloadrails-a166c21a49ddb5e9cca7ecde7cbb671f14a56fef.tar.gz
rails-a166c21a49ddb5e9cca7ecde7cbb671f14a56fef.tar.bz2
rails-a166c21a49ddb5e9cca7ecde7cbb671f14a56fef.zip
Allow inbound emails to be created on the fly
Diffstat (limited to 'test')
-rw-r--r--test/unit/inbound_email/incineration_test.rb2
-rw-r--r--test/unit/mailbox/callbacks_test.rb2
-rw-r--r--test/unit/mailbox/routing_test.rb4
-rw-r--r--test/unit/mailbox/state_test.rb2
-rw-r--r--test/unit/router_test.rb8
5 files changed, 11 insertions, 7 deletions
diff --git a/test/unit/inbound_email/incineration_test.rb b/test/unit/inbound_email/incineration_test.rb
index f2464b8cb8..3de0af3225 100644
--- a/test/unit/inbound_email/incineration_test.rb
+++ b/test/unit/inbound_email/incineration_test.rb
@@ -5,7 +5,7 @@ class ActionMailroom::InboundEmail::IncinerationTest < ActiveSupport::TestCase
freeze_time
assert_enqueued_with job: ActionMailroom::InboundEmail::IncinerationJob, at: 30.days.from_now do
- create_inbound_email("welcome.eml").delivered!
+ create_inbound_email_from_fixture("welcome.eml").delivered!
end
end
end
diff --git a/test/unit/mailbox/callbacks_test.rb b/test/unit/mailbox/callbacks_test.rb
index ada6410876..4cafeb3534 100644
--- a/test/unit/mailbox/callbacks_test.rb
+++ b/test/unit/mailbox/callbacks_test.rb
@@ -13,7 +13,7 @@ end
class ActionMailroom::Mailbox::CallbacksTest < ActiveSupport::TestCase
setup do
$before_processing = $after_processing = $around_processing = $processed = false
- @inbound_email = create_inbound_email("welcome.eml")
+ @inbound_email = create_inbound_email_from_fixture("welcome.eml")
end
test "all callback types" do
diff --git a/test/unit/mailbox/routing_test.rb b/test/unit/mailbox/routing_test.rb
index 6026686bea..4a8ed10eb0 100644
--- a/test/unit/mailbox/routing_test.rb
+++ b/test/unit/mailbox/routing_test.rb
@@ -13,7 +13,7 @@ end
class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase
setup do
$processed = false
- @inbound_email = create_inbound_email("welcome.eml")
+ @inbound_email = create_inbound_email_from_fixture("welcome.eml")
end
test "string routing" do
@@ -23,7 +23,7 @@ class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase
test "delayed routing" do
perform_enqueued_jobs only: ActionMailroom::RoutingJob do
- another_inbound_email = create_inbound_email("welcome.eml", status: :pending)
+ another_inbound_email = create_inbound_email_from_fixture("welcome.eml", status: :pending)
assert_equal "Discussion: Let's debate these attachments", $processed
end
end
diff --git a/test/unit/mailbox/state_test.rb b/test/unit/mailbox/state_test.rb
index 41fbafbd67..d73ecaa1e2 100644
--- a/test/unit/mailbox/state_test.rb
+++ b/test/unit/mailbox/state_test.rb
@@ -17,7 +17,7 @@ end
class ActionMailroom::Mailbox::StateTest < ActiveSupport::TestCase
setup do
$processed = false
- @inbound_email = create_inbound_email("welcome.eml")
+ @inbound_email = create_inbound_email_from_fixture("welcome.eml")
end
test "successful mailbox processing leaves inbound email in delivered state" do
diff --git a/test/unit/router_test.rb b/test/unit/router_test.rb
index 6bfd880b67..fa7ac2ba19 100644
--- a/test/unit/router_test.rb
+++ b/test/unit/router_test.rb
@@ -15,8 +15,12 @@ module ActionMailroom
end
test "routed to mailbox" do
- @router.route create_inbound_email("welcome.eml")
- assert_equal "Discussion: Let's debate these attachments", $processed
+ @router.route create_inbound_email_from_mail {
+ to "replies@example.com"
+ subject "This is a reply"
+ }
+
+ assert_equal "This is a reply", $processed
end
end
end