fix email spec; nokogiri needs a top-leve element

This commit is contained in:
danielgrippi 2012-05-08 18:21:38 -07:00
parent 0ec364e44c
commit 5d92d2464b

View file

@ -112,7 +112,8 @@ end
And /^I follow the "([^\"]*)" link from the last sent email$/ do |link_text|
email_text = Devise.mailer.deliveries.first.body.to_s
email_text = Devise.mailer.deliveries.first.html_part.body.raw_source if email_text.blank?
doc = Nokogiri(email_text)
doc = Nokogiri("<div>" + email_text + "</div>")
links = doc.css('a')
link = links.detect{ |link| link.text == link_text }
link = links.detect{ |link| link.attributes["href"].value.include?(link_text)} unless link