diff --git a/spec/oga/xpath/evaluator/axes_spec.rb b/spec/oga/xpath/evaluator/axes_spec.rb index 8799462..5b0f2d1 100644 --- a/spec/oga/xpath/evaluator/axes_spec.rb +++ b/spec/oga/xpath/evaluator/axes_spec.rb @@ -3,12 +3,12 @@ require 'spec_helper' describe Oga::XPath::Evaluator do before do @document = parse('') + @c_node = @document.children[0].children[0].children[0] end context 'ancestor axis' 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 context 'direct ancestors' do @@ -16,13 +16,7 @@ describe Oga::XPath::Evaluator do @set = @evaluator.evaluate('ancestor::b') end - example 'return a NodeSet instance' do - @set.is_a?(Oga::XML::NodeSet).should == true - end - - example 'return the right amount of rows' do - @set.length.should == 1 - end + it_behaves_like :node_set, :length => 1 example 'return the ancestor' do @set[0].name.should == 'b' @@ -34,13 +28,7 @@ describe Oga::XPath::Evaluator do @set = @evaluator.evaluate('ancestor::a') end - example 'return a NodeSet instance' do - @set.is_a?(Oga::XML::NodeSet).should == true - end - - example 'return the right amount of rows' do - @set.length.should == 1 - end + it_behaves_like :node_set, :length => 1 example 'return the ancestor' do @set[0].name.should == 'a'