Update matcher to ensure it fails on non-match
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/6c391f0e Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/6c391f0e Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/6c391f0e Branch: refs/heads/master Commit: 6c391f0e75ef76b8357d27bec404195e66f2c6d5 Parents: 03bd79f Author: Peter Donald <[email protected]> Authored: Sun May 25 17:19:57 2014 +1000 Committer: Peter Donald <[email protected]> Committed: Sun May 25 17:19:57 2014 +1000 ---------------------------------------------------------------------- spec/xpath_matchers.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/6c391f0e/spec/xpath_matchers.rb ---------------------------------------------------------------------- diff --git a/spec/xpath_matchers.rb b/spec/xpath_matchers.rb index e15bd3c..3bb3426 100644 --- a/spec/xpath_matchers.rb +++ b/spec/xpath_matchers.rb @@ -61,7 +61,7 @@ module RSpec def matches?(response) @response = response doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response) - ok = true + ok = false REXML::XPath.each(doc, @xpath) do |e| @actual_val = case e when REXML::Attribute @@ -71,6 +71,7 @@ module RSpec else e.to_s end + ok = true return false unless @val == @actual_val end return ok
