diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index f7657d2..6de912c 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -927,7 +927,7 @@ module Oga call_arg.assign(arg_ast).followed_by do converted = conversion.to_boolean(call_arg).not - block_given? ? converted.if_false { yield } : converted + block_given? ? converted.if_true { yield } : converted end end diff --git a/spec/oga/xpath/compiler/calls/not_spec.rb b/spec/oga/xpath/compiler/calls/not_spec.rb index b37f8b6..367411b 100644 --- a/spec/oga/xpath/compiler/calls/not_spec.rb +++ b/spec/oga/xpath/compiler/calls/not_spec.rb @@ -28,7 +28,8 @@ describe Oga::XPath::Compiler do describe 'in a predicate' do it 'returns a NodeSet containing all matching nodes ' do - evaluate_xpath(@document, 'root[not(node())]').should == node_set(@root) + evaluate_xpath(@document, 'root[not(comment())]') + .should == node_set(@root) end end end