Updated XPath specs for better namespace handling.
This commit is contained in:
parent
33c28f633b
commit
78da274452
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue