Piotr Brudny Piotr Brudny - 2 months ago 25
HTML Question

How to test mailto link in Cucumber?

I have a link like this:


< a href= "mailto:<%= @email %>?subject=Answer to complaint&body=<%= @salutation %>,">Answer< /a>


How can I test it using Cucumber/Capybara? I mean something more than just


And I should see "Answer"

Answer

It sounds like you're concerned that the @email and @salutation values in the mailto: links are correct.

You can do something like this

page.should have_xpath("//a[contains(@href,email)]"))