Created
November 29, 2011 16:10
-
-
Save kbaum/1405348 to your computer and use it in GitHub Desktop.
Converting absolute email links to relative links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionMailer::Base.default_url_options[:host] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pickle | |
module Email | |
def click_first_link_in_email(email) | |
link = absolute_link_to_relative(links_in_email(email).first) | |
visit link | |
end | |
def absolute_link_to_relative(link) | |
link.slice(/#{ActionMailer::Base.default_url_options[:host]}(.*)/, 1) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment