class RSpec::Rails::Matchers::ActionMailbox::ReceiveInboundEmail

@private

Attributes

inbound_email[R]
mailbox[R]
receiver[R]

Public Class Methods

new(message) click to toggle source
# File lib/rspec/rails/matchers/action_mailbox.rb, line 19
def initialize(message)
  super()

  @inbound_email = create_inbound_email(message)
end

Public Instance Methods

failure_message() click to toggle source
# File lib/rspec/rails/matchers/action_mailbox.rb, line 41
def failure_message
  "expected #{describe_inbound_email} to route to #{mailbox}".tap do |msg|
    if receiver
      msg << ", but routed to #{receiver} instead"
    end
  end
end
failure_message_when_negated() click to toggle source
# File lib/rspec/rails/matchers/action_mailbox.rb, line 49
def failure_message_when_negated
  "expected #{describe_inbound_email} not to route to #{mailbox}"
end
matches?(mailbox) click to toggle source
# File lib/rspec/rails/matchers/action_mailbox.rb, line 26
def matches?(mailbox)
  @mailbox  = mailbox
  @receiver = ApplicationMailbox.router.mailbox_for(inbound_email)

  @receiver == @mailbox
end

Private Instance Methods

describe_inbound_email() click to toggle source
# File lib/rspec/rails/matchers/action_mailbox.rb, line 57
def describe_inbound_email
  "mail to #{inbound_email.mail.to.to_sentence}"
end