module SanitizeEmail::RspecMatchers

Provides matchers that can be used in

Rspec tests to assert the behavior of email

Public Instance Methods

get_cc_username(email_message) click to toggle source
# File lib/sanitize_email/rspec_matchers.rb, line 57
def get_cc_username(email_message)
  username_header = email_message.header['X-Sanitize-Email-Cc']
  return username_header unless username_header.is_a?(Mail::Field)
  email_message.header.fields[3].value
end
get_fuzzy_body(email_message) click to toggle source
# File lib/sanitize_email/rspec_matchers.rb, line 70
def get_fuzzy_body(email_message)
  email_message.default_part_body.to_s.gsub(/\s+/, ' ')
end
get_fuzzy_matcher(to_fuzz) click to toggle source
# File lib/sanitize_email/rspec_matchers.rb, line 74
def get_fuzzy_matcher(to_fuzz)
  to_fuzz.gsub(/\s+/, ' ')
end
get_to_username(email_message) click to toggle source
# File lib/sanitize_email/rspec_matchers.rb, line 45
def get_to_username(email_message)
  username_header = email_message.header['X-Sanitize-Email-To']
  return username_header unless username_header.is_a?(Mail::Field)
  email_message.header.fields[3].value
end