Module: EmailSpec::MailExt

Defined in:
lib/email_spec/mail_ext.rb

Instance Method Summary collapse

Instance Method Details

#default_partObject



2
3
4
# File 'lib/email_spec/mail_ext.rb', line 2

def default_part
  @default_part ||= html_part || text_part || self
end

#default_part_bodyObject



6
7
8
9
# File 'lib/email_spec/mail_ext.rb', line 6

def default_part_body
  # Calling to_str as we want the actual String object
  HTMLEntities.new.decode(default_part.body.to_s.to_str)
end

#htmlObject



11
12
13
# File 'lib/email_spec/mail_ext.rb', line 11

def html
  html_part ? html_part.body.raw_source : nil
end