spec/spec_helper.rb in rpub-0.1.0 vs spec/spec_helper.rb in rpub-0.2.0

- old
+ new

@@ -1,6 +1,7 @@ require 'rpub' +require 'nokogiri' FIXTURES_DIRECTORY = File.expand_path('../fixtures', __FILE__) RSpec::Matchers.define :remove_file do |filename| match do |block| @@ -15,7 +16,13 @@ match do |block| before = File.exist?(filename) block.call after = File.exist?(filename) !before && after + end +end + +RSpec::Matchers.define :have_xpath do |xpath, *args| + match do |xml| + Nokogiri::XML(xml).xpath(xpath, *args).any? end end