aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2018-12-18 21:46:35 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2018-12-18 21:46:35 +0100
commita2c3b282577d1dc784898681763a400a0caad5c3 (patch)
tree8c549167ac5daaa81175348665626773dcb275f2
parent9082a0928fe1123c6f27344fc026789aab39d1ff (diff)
downloadrails-a2c3b282577d1dc784898681763a400a0caad5c3.tar.gz
rails-a2c3b282577d1dc784898681763a400a0caad5c3.tar.bz2
rails-a2c3b282577d1dc784898681763a400a0caad5c3.zip
Remove actions argument from Mailbox generator.
Generators only have the public `process` action, so there's nothing else to generate here. Skip the needless indirection.
-rw-r--r--lib/generators/rails/mailbox_generator.rb2
-rw-r--r--lib/generators/rails/templates/mailbox.rb.tt4
-rw-r--r--test/generators/mailbox_generator_test.rb12
3 files changed, 3 insertions, 15 deletions
diff --git a/lib/generators/rails/mailbox_generator.rb b/lib/generators/rails/mailbox_generator.rb
index 7b43173480..c2c403b8f6 100644
--- a/lib/generators/rails/mailbox_generator.rb
+++ b/lib/generators/rails/mailbox_generator.rb
@@ -5,8 +5,6 @@ module Rails
class MailboxGenerator < NamedBase
source_root File.expand_path("templates", __dir__)
- argument :actions, type: :array, default: [:process], banner: "method method"
-
check_class_collision suffix: "Mailbox"
def create_mailbox_file
diff --git a/lib/generators/rails/templates/mailbox.rb.tt b/lib/generators/rails/templates/mailbox.rb.tt
index 9788bd9bb4..56b138e2d9 100644
--- a/lib/generators/rails/templates/mailbox.rb.tt
+++ b/lib/generators/rails/templates/mailbox.rb.tt
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class <%= class_name %>Mailbox < ApplicationMailbox
-<% actions.each do |action| -%>
- def <%= action %>
+ def process
end
-<% end -%>
end
diff --git a/test/generators/mailbox_generator_test.rb b/test/generators/mailbox_generator_test.rb
index 8d3687cbaa..26ab5a44d7 100644
--- a/test/generators/mailbox_generator_test.rb
+++ b/test/generators/mailbox_generator_test.rb
@@ -57,7 +57,8 @@ class MailboxGeneratorTest < Rails::Generators::TestCase
end
def test_invokes_default_test_framework
- run_generator %w(inbox foo bar -t=test_unit)
+ run_generator %w(inbox -t=test_unit)
+
assert_file "test/mailboxes/inbox_mailbox_test.rb" do |test|
assert_match(/class InboxMailboxTest < ActionMailbox::TestCase/, test)
assert_match(/# test "receive mail" do/, test)
@@ -65,15 +66,6 @@ class MailboxGeneratorTest < Rails::Generators::TestCase
end
end
- def test_actions_are_turned_into_methods
- run_generator %w(inbox foo bar)
-
- assert_file "app/mailboxes/inbox_mailbox.rb" do |mailbox|
- assert_instance_method :foo, mailbox
- assert_instance_method :bar, mailbox
- end
- end
-
def test_mailbox_on_revoke
run_generator
run_generator ["inbox"], behavior: :revoke