Class: Capybara::Node::Email
- Inherits:
-
Document
- Object
- Document
- Capybara::Node::Email
- Defined in:
- lib/capybara/node/email.rb
Instance Method Summary collapse
-
#body ⇒ Mail::Message#body
Delegate to the email body.
-
#from ⇒ Mail::Message#from
Delegate to the email from.
-
#reply_to ⇒ Mail::Message#reply_to
Delegate to the email reply_to.
-
#save_and_open(file_name = nil) ⇒ Object
Save a snapshot of the page and open it in a browser for inspection.
-
#save_page(path = nil) ⇒ Object
Save a snapshot of the page.
-
#subject ⇒ Mail::Message#subject
Delegate to the email subject.
-
#to ⇒ Mail::Message#to
Delegate to the email to.
Instance Method Details
#body ⇒ Mail::Message#body
Delegate to the email body
6 7 8 |
# File 'lib/capybara/node/email.rb', line 6 def body base.raw end |
#from ⇒ Mail::Message#from
Delegate to the email from
34 35 36 |
# File 'lib/capybara/node/email.rb', line 34 def from base.from end |
#reply_to ⇒ Mail::Message#reply_to
Delegate to the email reply_to
27 28 29 |
# File 'lib/capybara/node/email.rb', line 27 def reply_to base.email.reply_to end |
#save_and_open(file_name = nil) ⇒ Object
Save a snapshot of the page and open it in a browser for inspection
56 57 58 59 60 61 |
# File 'lib/capybara/node/email.rb', line 56 def save_and_open(file_name = nil) require 'launchy' Launchy.open(save_page(file_name)) rescue LoadError warn 'Please install the launchy gem to open page with save_and_open_page' end |
#save_page(path = nil) ⇒ Object
Save a snapshot of the page.
42 43 44 45 46 47 48 49 50 |
# File 'lib/capybara/node/email.rb', line 42 def save_page(path = nil) path ||= "capybara-email-#{Time.new.strftime("%Y%m%d%H%M%S")}#{rand(10**10)}.html" path = File.(path, Capybara.save_and_open_page_path) if Capybara.save_and_open_page_path FileUtils.mkdir_p(File.dirname(path)) File.open(path,'w') { |f| f.write(body) } path end |
#subject ⇒ Mail::Message#subject
Delegate to the email subject
13 14 15 |
# File 'lib/capybara/node/email.rb', line 13 def subject base.subject end |
#to ⇒ Mail::Message#to
Delegate to the email to
20 21 22 |
# File 'lib/capybara/node/email.rb', line 20 def to base.to end |