From ffcefa92a7d3aaf96797f5f9fc3cfbc3d5733ecf Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 11 Aug 2014 09:33:09 +0200 Subject: [PATCH] Eval specs for the descendant-or-self short axis. This currently fails due to the node() function not being implemented just yet. --- .../evaluator/axes/descendant_or_self_spec.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb b/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb index 8ef745e..5baf389 100644 --- a/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb +++ b/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb @@ -87,5 +87,33 @@ describe Oga::XPath::Evaluator do it_behaves_like :empty_node_set end + + context 'direct descendants using the short form' do + before do + @set = @evaluator.evaluate('//b') + end + + it_behaves_like :node_set, :length => 2 + + example 'return the first node' do + @set[0].should == @first_b + end + + example 'return the second node' do + @set[1].should == @second_b + end + end + + context 'nested descendants using the short form' do + before do + @set = @evaluator.evaluate('//c') + end + + it_behaves_like :node_set, :length => 1 + + example 'return the node' do + @set[0].should == @first_c + end + end end end