Corrected XPath attribute axis specs.
This commit is contained in:
parent
23de57a3a0
commit
28f77b6d9b
|
@ -3,11 +3,11 @@ require 'spec_helper'
|
||||||
describe Oga::XPath::Evaluator do
|
describe Oga::XPath::Evaluator do
|
||||||
context 'attribute axis' do
|
context 'attribute axis' do
|
||||||
before do
|
before do
|
||||||
document = parse('<a foo="bar"><b x="y"></b></a>')
|
document = parse('<a foo="bar"></a>')
|
||||||
@evaluator = described_class.new(document)
|
@evaluator = described_class.new(document.children[0])
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'top-level attributes' do
|
context 'element attributes' do
|
||||||
before do
|
before do
|
||||||
@set = @evaluator.evaluate('attribute::foo')
|
@set = @evaluator.evaluate('attribute::foo')
|
||||||
end
|
end
|
||||||
|
@ -23,22 +23,6 @@ describe Oga::XPath::Evaluator do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'nested attributes' do
|
|
||||||
before do
|
|
||||||
@set = @evaluator.evaluate('/a/attribute::x')
|
|
||||||
end
|
|
||||||
|
|
||||||
it_behaves_like :node_set, :length => 1
|
|
||||||
|
|
||||||
example 'return an Attribute instance' do
|
|
||||||
@set[0].is_a?(Oga::XML::Attribute).should == true
|
|
||||||
end
|
|
||||||
|
|
||||||
example 'return the correct attribute' do
|
|
||||||
@set[0].name.should == 'x'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'non existing attributes' do
|
context 'non existing attributes' do
|
||||||
before do
|
before do
|
||||||
@set = @evaluator.evaluate('attribute::bar')
|
@set = @evaluator.evaluate('attribute::bar')
|
||||||
|
|
Loading…
Reference in New Issue