Use a shared example in the axes evaluation specs.
This commit is contained in:
parent
580856dcf7
commit
9a8f53bb49
|
@ -3,12 +3,12 @@ require 'spec_helper'
|
||||||
describe Oga::XPath::Evaluator do
|
describe Oga::XPath::Evaluator do
|
||||||
before do
|
before do
|
||||||
@document = parse('<a><b><c></c></b><d></d></a>')
|
@document = parse('<a><b><c></c></b><d></d></a>')
|
||||||
|
@c_node = @document.children[0].children[0].children[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'ancestor axis' do
|
context 'ancestor axis' do
|
||||||
before do
|
before do
|
||||||
c_node = @document.children[0].children[0].children[0]
|
@evaluator = described_class.new(@c_node)
|
||||||
@evaluator = described_class.new(c_node)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'direct ancestors' do
|
context 'direct ancestors' do
|
||||||
|
@ -16,13 +16,7 @@ describe Oga::XPath::Evaluator do
|
||||||
@set = @evaluator.evaluate('ancestor::b')
|
@set = @evaluator.evaluate('ancestor::b')
|
||||||
end
|
end
|
||||||
|
|
||||||
example 'return a NodeSet instance' do
|
it_behaves_like :node_set, :length => 1
|
||||||
@set.is_a?(Oga::XML::NodeSet).should == true
|
|
||||||
end
|
|
||||||
|
|
||||||
example 'return the right amount of rows' do
|
|
||||||
@set.length.should == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
example 'return the <b> ancestor' do
|
example 'return the <b> ancestor' do
|
||||||
@set[0].name.should == 'b'
|
@set[0].name.should == 'b'
|
||||||
|
@ -34,13 +28,7 @@ describe Oga::XPath::Evaluator do
|
||||||
@set = @evaluator.evaluate('ancestor::a')
|
@set = @evaluator.evaluate('ancestor::a')
|
||||||
end
|
end
|
||||||
|
|
||||||
example 'return a NodeSet instance' do
|
it_behaves_like :node_set, :length => 1
|
||||||
@set.is_a?(Oga::XML::NodeSet).should == true
|
|
||||||
end
|
|
||||||
|
|
||||||
example 'return the right amount of rows' do
|
|
||||||
@set.length.should == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
example 'return the <b> ancestor' do
|
example 'return the <b> ancestor' do
|
||||||
@set[0].name.should == 'a'
|
@set[0].name.should == 'a'
|
||||||
|
|
Loading…
Reference in New Issue