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
|
||||
context 'attribute axis' do
|
||||
before do
|
||||
document = parse('<a foo="bar"><b x="y"></b></a>')
|
||||
@evaluator = described_class.new(document)
|
||||
document = parse('<a foo="bar"></a>')
|
||||
@evaluator = described_class.new(document.children[0])
|
||||
end
|
||||
|
||||
context 'top-level attributes' do
|
||||
context 'element attributes' do
|
||||
before do
|
||||
@set = @evaluator.evaluate('attribute::foo')
|
||||
end
|
||||
|
@ -23,22 +23,6 @@ describe Oga::XPath::Evaluator do
|
|||
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
|
||||
before do
|
||||
@set = @evaluator.evaluate('attribute::bar')
|
||||
|
|
Loading…
Reference in New Issue