Rspec custom matchers for xml using Nokogiri XPath selector and optional content to match within selection. See matcher_spec.rb for usage.
Place have_xml.rb in your {Rails.root}/spec/support/matchers directory
Adapted from: Testing XML with rspec, xpath and libxml
line 22 in the first file is wrong still
line 2 in the second file also copied the syntax error