fix email spec; nokogiri needs a top-leve element
This commit is contained in:
parent
0ec364e44c
commit
5d92d2464b
1 changed files with 2 additions and 1 deletions
|
|
@ -112,7 +112,8 @@ end
|
||||||
And /^I follow the "([^\"]*)" link from the last sent email$/ do |link_text|
|
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.body.to_s
|
||||||
email_text = Devise.mailer.deliveries.first.html_part.body.raw_source if email_text.blank?
|
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')
|
links = doc.css('a')
|
||||||
link = links.detect{ |link| link.text == link_text }
|
link = links.detect{ |link| link.text == link_text }
|
||||||
link = links.detect{ |link| link.attributes["href"].value.include?(link_text)} unless link
|
link = links.detect{ |link| link.attributes["href"].value.include?(link_text)} unless link
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue