Instead, you can use new_mail.body.to_sit to get an uncoded version, as described in the Rails Testing Guide .
Capybara, ( html), , , :
let(:email){ Capybara::Node::Simple.new(new_mail.body.to_s) }
it "has a link" do
url = url_for(controller:'some_controller',action:'some_action',some_param:some_param)
expect(email).to have_link('A link', href: url)
end
:
:
def get_message_part(mail, content_type)
mail.body.parts.find { |p| p.content_type.match content_type }.body.raw_source
end
let(:email) { Capybara::Node::Simple.new(get_message_part(new_mail, /html/)) }