Cleaned up XPath last() specs a bit
This commit is contained in:
parent
ee44907ca5
commit
7a4cb76d39
|
@ -5,11 +5,18 @@ describe Oga::XPath::Compiler do
|
|||
before do
|
||||
@document = parse('<root><a>foo</a><a>bar</a></root>')
|
||||
|
||||
@a1 = @document.children[0].children[0]
|
||||
@a2 = @document.children[0].children[1]
|
||||
end
|
||||
|
||||
it 'returns a node set containing the last node' do
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue