diff --git a/spec/oga/xpath/evaluator/axes/self_spec.rb b/spec/oga/xpath/evaluator/axes/self_spec.rb index c6a7444..b499ce9 100644 --- a/spec/oga/xpath/evaluator/axes/self_spec.rb +++ b/spec/oga/xpath/evaluator/axes/self_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Oga::XPath::Evaluator do context 'self axis' do before do - @document = parse('foobar') + @document = parse('foobartest') @evaluator = described_class.new(@document) end @@ -41,7 +41,7 @@ describe Oga::XPath::Evaluator do context 'matching nodes inside predicates' do before do - @set = @evaluator.evaluate('a/b[.="foo"]') + @set = @evaluator.evaluate('a/b[. = "foo"]') end it_behaves_like :node_set, :length => 1 @@ -50,5 +50,29 @@ describe Oga::XPath::Evaluator do @set[0].should == @document.children[0].children[0] end end + + context 'using self inside a path inside a predicate' do + before do + @set = @evaluator.evaluate('a/b[c/. = "test"]') + end + + it_behaves_like :node_set, :length => 1 + + example 'return the second node' do + @set[0].should == @document.children[0].children[1] + end + end + + context 'using self inside a nested predicate' do + before do + @set = @evaluator.evaluate('a/b[c[. = "test"]]') + end + + it_behaves_like :node_set, :length => 1 + + example 'return the second node' do + @set[0].should == @document.children[0].children[1] + end + end end end