Updated XPath specs for better namespace handling.

This commit is contained in:
Yorick Peterse 2014-08-11 00:42:06 +02:00
parent 33c28f633b
commit 78da274452
3 changed files with 5 additions and 5 deletions

View File

@ -26,10 +26,10 @@ describe Oga::XPath::Evaluator do
context '#node_matches?' do context '#node_matches?' do
before do before do
ns = Oga::XML::Namespace.new(:name => 'x')
@name_node = Oga::XML::Element.new(:name => 'a') @name_node = Oga::XML::Element.new(:name => 'a')
@name_ns_node = Oga::XML::Element.new(:name => 'b', :namespace => ns) @name_ns_node = Oga::XML::Element.new(:name => 'b', :namespace_name => 'x')
@name_ns_node.register_namespace('x', 'y')
end end
example 'return true if a node is matched by its name' do example 'return true if a node is matched by its name' do

View File

@ -2,7 +2,7 @@ require 'spec_helper'
describe Oga::XPath::Evaluator do describe Oga::XPath::Evaluator do
before do before do
@document = parse('<a>Foo<b></b><b></b><ns1:c></ns1:c></a>') @document = parse('<a xmlns:ns1="x">Foo<b></b><b></b><ns1:c></ns1:c></a>')
end end
context 'absolute paths' do context 'absolute paths' do

View File

@ -2,7 +2,7 @@ require 'spec_helper'
describe Oga::XPath::Evaluator do describe Oga::XPath::Evaluator do
before do before do
@document = parse('<a><b></b><b></b><ns1:c></ns1:c></a>') @document = parse('<a xmlns:ns1="x"><b></b><b></b><ns1:c></ns1:c></a>')
@evaluator = described_class.new(@document) @evaluator = described_class.new(@document)
end end