Search code examples
htmlruby-on-railscucumbermailto

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"


Solution

  • 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)]"))