модуль ActionMailbox::TestHelper
Общедоступные методы экземпляра
# File actionmailbox/lib/action_mailbox/test_helper.rb, line 9 def create_inbound_email_from_fixture(fixture_name, status: :processing) create_inbound_email_from_source file_fixture(fixture_name).read, status: status end
Создать запись InboundEmail, используя фикстуру eml в формате message/rfc822, со ссылкой на fixture_name, расположенную в test/fixtures/files/fixture_name.
# File actionmailbox/lib/action_mailbox/test_helper.rb, line 16 def create_inbound_email_from_mail(status: :processing, **mail_options) mail = Mail.new(mail_options) # Bcc header is not encoded by default mail[:bcc].include_in_headers = true if mail[:bcc] create_inbound_email_from_source mail.to_s, status: status end
Создать InboundEmail, указав его с помощью опций Mail.new. Пример:
create_inbound_email_from_mail(from: "david@loudthinking.com", subject: "Hello!")
# File actionmailbox/lib/action_mailbox/test_helper.rb, line 25 def create_inbound_email_from_source(source, status: :processing) ActionMailbox::InboundEmail.create_and_extract_message_id! source, status: status end
Создать InboundEmail, используя исходный текст в формате rfc822 source.
# File actionmailbox/lib/action_mailbox/test_helper.rb, line 32 def receive_inbound_email_from_fixture(*args) create_inbound_email_from_fixture(*args).tap(&:route) end
Создать InboundEmail из фикстуры, используя те же аргументы, что и create_inbound_email_from_fixture, и немедленно направить его на обработку.
# File actionmailbox/lib/action_mailbox/test_helper.rb, line 38 def receive_inbound_email_from_mail(**kwargs) create_inbound_email_from_mail(**kwargs).tap(&:route) end
Создать InboundEmail, используя те же аргументы, что и create_inbound_email_from_mail, и немедленно направить его на обработку.
# File actionmailbox/lib/action_mailbox/test_helper.rb, line 44 def receive_inbound_email_from_source(*args) create_inbound_email_from_source(*args).tap(&:route) end
Создать InboundEmail, используя те же аргументы, что и create_inbound_email_from_source, и немедленно направить его на обработку.
© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.