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
|
before do
|
||||||
@document = parse('<root><a>foo</a><a>bar</a></root>')
|
@document = parse('<root><a>foo</a><a>bar</a></root>')
|
||||||
|
|
||||||
|
@a1 = @document.children[0].children[0]
|
||||||
@a2 = @document.children[0].children[1]
|
@a2 = @document.children[0].children[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a node set containing the last node' do
|
describe 'in a predicate' do
|
||||||
evaluate_xpath(@document, 'root/a[last()]').should == node_set(@a2)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue