Class: RSpec::Rails::Matchers::SendEmail Private

Inherits:
BaseMatcher show all
Defined in:
lib/rspec/rails/matchers/send_email.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Matcher class for send_email. Should not be instantiated directly.

See Also:

Constant Summary collapse

INSPECT_EMAIL_ATTRIBUTES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Define the email attributes that should be included in the inspection output.

%i[subject from to cc bcc].freeze

Constants inherited from BaseMatcher

BaseMatcher::UNDEFINED

Instance Method Summary collapse

Methods inherited from BaseMatcher

#description, #expects_call_stack_jump?, #match_unless_raises

Constructor Details

#initialize(criteria) ⇒ SendEmail

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SendEmail.

16
17
18
# File 'lib/rspec/rails/matchers/send_email.rb', line 16
def initialize(criteria)
  @criteria = criteria
end

Instance Method Details

#failure_messageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)
38
39
40
41
42
43
44
45
46
# File 'lib/rspec/rails/matchers/send_email.rb', line 38
def failure_message
  result =
    if multiple_match?
      "More than 1 matching emails were sent."
    else
      "No matching emails were sent."
    end
  "#{result}#{sent_emails_message}"
end

#failure_message_when_negatedString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)
50
51
52
# File 'lib/rspec/rails/matchers/send_email.rb', line 50
def failure_message_when_negated
  "Expected not to send an email but it was sent."
end

#matches?(block) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)
30
31
32
33
34
# File 'lib/rspec/rails/matchers/send_email.rb', line 30
def matches?(block)
  define_matched_emails(block)
  @matched_emails.one?
end

#supports_block_expectations?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)
26
27
28
# File 'lib/rspec/rails/matchers/send_email.rb', line 26
def supports_block_expectations?
  true
end

#supports_value_expectations?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)
21
22
23
# File 'lib/rspec/rails/matchers/send_email.rb', line 21
def supports_value_expectations?
  false
end