From 6039e1dbebc1ba86dc558ecd89657dc73c3cbbb9 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 18 Mar 2015 23:55:51 +0100 Subject: [PATCH] XPath parsing spec for axes with predicates --- spec/oga/xpath/parser/axes_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/oga/xpath/parser/axes_spec.rb b/spec/oga/xpath/parser/axes_spec.rb index 0c9dc67..611c92b 100644 --- a/spec/oga/xpath/parser/axes_spec.rb +++ b/spec/oga/xpath/parser/axes_spec.rb @@ -9,6 +9,13 @@ describe Oga::XPath::Parser do ) end + it 'parses the ancestor axis with a predicate' do + parse_xpath('/ancestor::A[1]').should == s( + :absolute_path, + s(:predicate, s(:axis, 'ancestor', s(:test, nil, 'A')), s(:int, 1)) + ) + end + it 'parses the ancestor-or-self axis' do parse_xpath('/ancestor-or-self::A').should == s( :absolute_path,