module RSpec::Rails::MailboxExampleGroup
@api public Container module for mailbox spec functionality.
Public Class Methods
Source
# File lib/rspec/rails/example/mailbox_example_group.rb, line 13 def self.create_inbound_email(arg) case arg when Hash create_inbound_email_from_mail(**arg) else create_inbound_email_from_source(arg.to_s) end end
@private
Public Instance Methods
Source
# File lib/rspec/rails/example/mailbox_example_group.rb, line 44 def have_been_delivered satisfy('have been delivered', &:delivered?) end
@api public Passes if the inbound email was delivered
@example
inbound_email = process(args) expect(inbound_email).to have_been_delivered
Source
# File lib/rspec/rails/example/mailbox_example_group.rb, line 54 def have_bounced satisfy('have bounced', &:bounced?) end
@api public Passes if the inbound email bounced during processing
@example
inbound_email = process(args) expect(inbound_email).to have_bounced
Source
# File lib/rspec/rails/example/mailbox_example_group.rb, line 64 def have_failed satisfy('have failed', &:failed?) end
@api public Passes if the inbound email failed to process
@example
inbound_email = process(args) expect(inbound_email).to have_failed
Source
# File lib/rspec/rails/example/mailbox_example_group.rb, line 29 def mailbox_class described_class end
@private
Source
# File lib/rspec/rails/example/mailbox_example_group.rb, line 73 def process(message) MailboxExampleGroup.create_inbound_email(message).tap do |mail| self.class.mailbox_class.receive(mail) end end
Process an inbound email message directly, bypassing routing.
@param message [Hash, Mail::Message] a mail message or hash of
attributes used to build one
@return [ActionMailbox::InboundMessage]