module RSpec::Rails::MailboxExampleGroup
@api public Container module for mailbox spec functionality.
Public Class Methods
create_inbound_email(arg)
click to toggle source
@private
# 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
Public Instance Methods
have_been_delivered()
click to toggle source
@api public Passes if the inbound email was delivered
@example
inbound_email = process(args) expect(inbound_email).to have_been_delivered
# File lib/rspec/rails/example/mailbox_example_group.rb, line 44 def have_been_delivered satisfy('have been delivered', &:delivered?) end
have_bounced()
click to toggle source
@api public Passes if the inbound email bounced during processing
@example
inbound_email = process(args) expect(inbound_email).to have_bounced
# File lib/rspec/rails/example/mailbox_example_group.rb, line 54 def have_bounced satisfy('have bounced', &:bounced?) end
have_failed()
click to toggle source
@api public Passes if the inbound email failed to process
@example
inbound_email = process(args) expect(inbound_email).to have_failed
# File lib/rspec/rails/example/mailbox_example_group.rb, line 64 def have_failed satisfy('have failed', &:failed?) end
mailbox_class()
click to toggle source
@private
# File lib/rspec/rails/example/mailbox_example_group.rb, line 29 def mailbox_class described_class end
process(message)
click to toggle source
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]
# 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