diff --git a/spec/oga/xpath/compiler/calls/last_spec.rb b/spec/oga/xpath/compiler/calls/last_spec.rb index 099f023..22f1c09 100644 --- a/spec/oga/xpath/compiler/calls/last_spec.rb +++ b/spec/oga/xpath/compiler/calls/last_spec.rb @@ -5,11 +5,18 @@ describe Oga::XPath::Compiler do before do @document = parse('foobar') + @a1 = @document.children[0].children[0] @a2 = @document.children[0].children[1] end - it 'returns a node set containing the last node' do - evaluate_xpath(@document, 'root/a[last()]').should == node_set(@a2) + describe 'in a predicate' do + it 'returns a NodeSet containing the last node' do + evaluate_xpath(@document, 'root/a[last()]').should == node_set(@a2) + end + + it 'returns a NodeSet containing all but the last node' do + evaluate_xpath(@document, 'root/a[1 < last()]').should == node_set(@a1) + end end end end