From 8a0a1034955544ee2e4c1f85317c0db84f3aa55b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 28 Sep 2018 12:19:43 -0700 Subject: ActionMailroom -> ActionMailbox We didn't end up using the mailroom metaphor directly, so let's stick with a more conventional naming strategy. --- test/.DS_Store | Bin 0 -> 6148 bytes test/dummy/app/mailboxes/application_mailbox.rb | 2 +- test/dummy/config/application.rb | 2 +- test/dummy/db/development.sqlite3 | Bin 49152 -> 0 bytes .../20180208205311_create_action_mailroom_tables.rb | 4 ++-- test/dummy/db/schema.rb | 2 +- test/test_helper.rb | 4 ++-- test/unit/.DS_Store | Bin 0 -> 6148 bytes test/unit/controller_test.rb | 8 ++++---- test/unit/inbound_email/incineration_test.rb | 4 ++-- test/unit/inbound_email/message_id_test.rb | 2 +- test/unit/inbound_email_test.rb | 2 +- test/unit/mailbox/callbacks_test.rb | 4 ++-- test/unit/mailbox/routing_test.rb | 8 ++++---- test/unit/mailbox/state_test.rb | 8 ++++---- test/unit/router_test.rb | 10 +++++----- 16 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 test/.DS_Store delete mode 100644 test/dummy/db/development.sqlite3 create mode 100644 test/unit/.DS_Store (limited to 'test') diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 0000000000..4baab2932c Binary files /dev/null and b/test/.DS_Store differ diff --git a/test/dummy/app/mailboxes/application_mailbox.rb b/test/dummy/app/mailboxes/application_mailbox.rb index 3ea37aaf8f..47fb2017d6 100644 --- a/test/dummy/app/mailboxes/application_mailbox.rb +++ b/test/dummy/app/mailboxes/application_mailbox.rb @@ -1,2 +1,2 @@ -class ApplicationMailbox < ActionMailroom::Mailbox +class ApplicationMailbox < ActionMailbox::Base end diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index dc57837cde..5018690331 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -3,7 +3,7 @@ require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) -require "action_mailroom" +require "action_mailbox" module Dummy class Application < Rails::Application diff --git a/test/dummy/db/development.sqlite3 b/test/dummy/db/development.sqlite3 deleted file mode 100644 index 8bd6b8dec3..0000000000 Binary files a/test/dummy/db/development.sqlite3 and /dev/null differ diff --git a/test/dummy/db/migrate/20180208205311_create_action_mailroom_tables.rb b/test/dummy/db/migrate/20180208205311_create_action_mailroom_tables.rb index cea05a6437..85e19bc3c6 100644 --- a/test/dummy/db/migrate/20180208205311_create_action_mailroom_tables.rb +++ b/test/dummy/db/migrate/20180208205311_create_action_mailroom_tables.rb @@ -1,6 +1,6 @@ -class CreateActionMailroomTables < ActiveRecord::Migration[5.2] +class CreateActionMailboxTables < ActiveRecord::Migration[5.2] def change - create_table :action_mailroom_inbound_emails do |t| + create_table :action_mailbox_inbound_emails do |t| t.integer :status, default: 0, null: false t.string :message_id diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 339a6b2afd..6cfe7de765 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -12,7 +12,7 @@ ActiveRecord::Schema.define(version: 2018_02_12_164506) do - create_table "action_mailroom_inbound_emails", force: :cascade do |t| + create_table "action_mailbox_inbound_emails", force: :cascade do |t| t.integer "status", default: 0, null: false t.string "message_id" t.datetime "created_at", precision: 6 diff --git a/test/test_helper.rb b/test/test_helper.rb index 50ddc85463..b042cfb679 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -22,10 +22,10 @@ if ActiveSupport::TestCase.respond_to?(:fixture_path=) ActiveSupport::TestCase.fixtures :all end -require "action_mailroom/test_helper" +require "action_mailbox/test_helper" class ActiveSupport::TestCase - include ActionMailroom::TestHelper, ActiveJob::TestHelper + include ActionMailbox::TestHelper, ActiveJob::TestHelper end if ARGV.include?("-v") diff --git a/test/unit/.DS_Store b/test/unit/.DS_Store new file mode 100644 index 0000000000..69403a911f Binary files /dev/null and b/test/unit/.DS_Store differ diff --git a/test/unit/controller_test.rb b/test/unit/controller_test.rb index f2a49f415f..508e561244 100644 --- a/test/unit/controller_test.rb +++ b/test/unit/controller_test.rb @@ -1,19 +1,19 @@ require_relative '../test_helper' -class ActionMailroom::InboundEmailsControllerTest < ActionDispatch::IntegrationTest +class ActionMailbox::InboundEmailsControllerTest < ActionDispatch::IntegrationTest test "receiving a valid RFC 822 message" do - assert_difference -> { ActionMailroom::InboundEmail.count }, +1 do + assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do post_inbound_email "welcome.eml" end assert_response :created - inbound_email = ActionMailroom::InboundEmail.last + inbound_email = ActionMailbox::InboundEmail.last assert_equal file_fixture('../files/welcome.eml').read, inbound_email.raw_email.download end test "rejecting a message of an unsupported type" do - assert_no_difference -> { ActionMailroom::InboundEmail.count } do + assert_no_difference -> { ActionMailbox::InboundEmail.count } do post rails_inbound_emails_url, params: { message: fixture_file_upload('files/text.txt', 'text/plain') } end diff --git a/test/unit/inbound_email/incineration_test.rb b/test/unit/inbound_email/incineration_test.rb index 3de0af3225..212325b92d 100644 --- a/test/unit/inbound_email/incineration_test.rb +++ b/test/unit/inbound_email/incineration_test.rb @@ -1,10 +1,10 @@ require_relative '../../test_helper' -class ActionMailroom::InboundEmail::IncinerationTest < ActiveSupport::TestCase +class ActionMailbox::InboundEmail::IncinerationTest < ActiveSupport::TestCase test "incinerate emails 30 days after they have been processed" do freeze_time - assert_enqueued_with job: ActionMailroom::InboundEmail::IncinerationJob, at: 30.days.from_now do + assert_enqueued_with job: ActionMailbox::InboundEmail::IncinerationJob, at: 30.days.from_now do create_inbound_email_from_fixture("welcome.eml").delivered! end end diff --git a/test/unit/inbound_email/message_id_test.rb b/test/unit/inbound_email/message_id_test.rb index 75c15a531a..aa9ce90b4c 100644 --- a/test/unit/inbound_email/message_id_test.rb +++ b/test/unit/inbound_email/message_id_test.rb @@ -1,6 +1,6 @@ require_relative '../../test_helper' -class ActionMailroom::InboundEmail::MessageIdTest < ActiveSupport::TestCase +class ActionMailbox::InboundEmail::MessageIdTest < ActiveSupport::TestCase test "message id is extracted from raw email" do inbound_email = create_inbound_email_from_fixture("welcome.eml") assert_equal "0CB459E0-0336-41DA-BC88-E6E28C697DDB@37signals.com", inbound_email.message_id diff --git a/test/unit/inbound_email_test.rb b/test/unit/inbound_email_test.rb index e4b7be2440..7c42188584 100644 --- a/test/unit/inbound_email_test.rb +++ b/test/unit/inbound_email_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -module ActionMailroom +module ActionMailbox class InboundEmailTest < ActiveSupport::TestCase test "mail provides the parsed source" do assert_equal "Discussion: Let's debate these attachments", create_inbound_email_from_fixture("welcome.eml").mail.subject diff --git a/test/unit/mailbox/callbacks_test.rb b/test/unit/mailbox/callbacks_test.rb index 4cafeb3534..b6cfef9868 100644 --- a/test/unit/mailbox/callbacks_test.rb +++ b/test/unit/mailbox/callbacks_test.rb @@ -1,6 +1,6 @@ require_relative '../../test_helper' -class CallbackMailbox < ActionMailroom::Mailbox +class CallbackMailbox < ActionMailbox::Base before_processing { $before_processing = "Ran that!" } after_processing { $after_processing = "Ran that too!" } around_processing ->(r, block) { block.call; $around_processing = "Ran that as well!" } @@ -10,7 +10,7 @@ class CallbackMailbox < ActionMailroom::Mailbox end end -class ActionMailroom::Mailbox::CallbacksTest < ActiveSupport::TestCase +class ActionMailbox::Base::CallbacksTest < ActiveSupport::TestCase setup do $before_processing = $after_processing = $around_processing = $processed = false @inbound_email = create_inbound_email_from_fixture("welcome.eml") diff --git a/test/unit/mailbox/routing_test.rb b/test/unit/mailbox/routing_test.rb index 4a8ed10eb0..320dee6aab 100644 --- a/test/unit/mailbox/routing_test.rb +++ b/test/unit/mailbox/routing_test.rb @@ -1,16 +1,16 @@ require_relative '../../test_helper' -class ApplicationMailbox < ActionMailroom::Mailbox +class ApplicationMailbox < ActionMailbox::Base routing "replies@example.com" => :replies end -class RepliesMailbox < ActionMailroom::Mailbox +class RepliesMailbox < ActionMailbox::Base def process $processed = mail.subject end end -class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase +class ActionMailbox::Base::RoutingTest < ActiveSupport::TestCase setup do $processed = false @inbound_email = create_inbound_email_from_fixture("welcome.eml") @@ -22,7 +22,7 @@ class ActionMailroom::Mailbox::RoutingTest < ActiveSupport::TestCase end test "delayed routing" do - perform_enqueued_jobs only: ActionMailroom::RoutingJob do + perform_enqueued_jobs only: ActionMailbox::RoutingJob do another_inbound_email = create_inbound_email_from_fixture("welcome.eml", status: :pending) assert_equal "Discussion: Let's debate these attachments", $processed end diff --git a/test/unit/mailbox/state_test.rb b/test/unit/mailbox/state_test.rb index 6215e02837..32d16ca8fe 100644 --- a/test/unit/mailbox/state_test.rb +++ b/test/unit/mailbox/state_test.rb @@ -1,12 +1,12 @@ require_relative '../../test_helper' -class SuccessfulMailbox < ActionMailroom::Mailbox +class SuccessfulMailbox < ActionMailbox::Base def process $processed = mail.subject end end -class UnsuccessfulMailbox < ActionMailroom::Mailbox +class UnsuccessfulMailbox < ActionMailbox::Base rescue_from(RuntimeError) { $processed = :failure } def process @@ -14,7 +14,7 @@ class UnsuccessfulMailbox < ActionMailroom::Mailbox end end -class BouncingMailbox < ActionMailroom::Mailbox +class BouncingMailbox < ActionMailbox::Base def process $processed = :bounced bounced! @@ -22,7 +22,7 @@ class BouncingMailbox < ActionMailroom::Mailbox end -class ActionMailroom::Mailbox::StateTest < ActiveSupport::TestCase +class ActionMailbox::Base::StateTest < ActiveSupport::TestCase setup do $processed = false @inbound_email = create_inbound_email_from_mail \ diff --git a/test/unit/router_test.rb b/test/unit/router_test.rb index 678810a900..e244ff45f4 100644 --- a/test/unit/router_test.rb +++ b/test/unit/router_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class RootMailbox < ActionMailroom::Mailbox +class RootMailbox < ActionMailbox::Base def process $processed_by = self.class.to_s $processed_mail = mail @@ -19,10 +19,10 @@ class FirstMailboxAddress end end -module ActionMailroom +module ActionMailbox class RouterTest < ActiveSupport::TestCase setup do - @router = ActionMailroom::Router.new + @router = ActionMailbox::Router.new $processed_by = $processed_mail = nil end @@ -82,7 +82,7 @@ module ActionMailroom end test "missing route" do - assert_raises(ActionMailroom::Router::RoutingError) do + assert_raises(ActionMailbox::Router::RoutingError) do inbound_email = create_inbound_email_from_mail(to: "going-nowhere@example.com", subject: "This is a reply") @router.route inbound_email assert inbound_email.bounced? @@ -90,7 +90,7 @@ module ActionMailroom end test "invalid address" do - assert_raises(ActionMailroom::Router::Route::InvalidAddressError) do + assert_raises(ActionMailbox::Router::Route::InvalidAddressError) do @router.add_route Array.new, to: :first @router.route create_inbound_email_from_mail(to: "replies-nowhere@example.com", subject: "This is a reply") end -- cgit v1.2.3