diff --git a/spec/oga/xpath/evaluator/wildcard_spec.rb b/spec/oga/xpath/evaluator/wildcard_spec.rb
index c468f67..8e90232 100644
--- a/spec/oga/xpath/evaluator/wildcard_spec.rb
+++ b/spec/oga/xpath/evaluator/wildcard_spec.rb
@@ -1,82 +1,30 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- before do
- @document = parse('')
- @evaluator = described_class.new(@document)
- end
-
- context 'full wildcards' do
+ context 'wildcard paths' do
before do
- @set = @evaluator.evaluate('a/*')
+ @document = parse('')
+
+ @a1 = @document.children[0]
+ @b1 = @a1.children[0]
+ @b2 = @a1.children[1]
+ @c1 = @a1.children[2]
end
- it_behaves_like :node_set, :length => 3
-
- example 'include the first node' do
- @set[0].name.should == 'b'
+ example 'evaluate a wildcard path' do
+ evaluate_xpath(@document, 'a/*').should == @a1.children
end
- example 'include the second node' do
- @set[1].name.should == 'b'
+ example 'evaluate a path using a namespace wildcard' do
+ evaluate_xpath(@document, 'a/*:b').should == node_set(@b1, @b2)
end
- example 'include the node' do
- @set[2].name.should == 'c'
- @set[2].namespace.name.should == 'ns1'
- end
- end
-
- context 'namespace wildcards' do
- before do
- @set = @evaluator.evaluate('a/*:b')
+ example 'evaluate a path using a namespace and a name wildcard' do
+ evaluate_xpath(@document, 'a/ns1:*').should == node_set(@c1)
end
- it_behaves_like :node_set, :length => 2
-
- example 'include the first node' do
- @set[0].name.should == 'b'
- end
-
- example 'include the second node' do
- @set[1].name.should == 'b'
- end
-
- example 'ensure the nodes are the individual nodes' do
- @set[0].should_not == @set[1]
- end
- end
-
- context 'name wildcards' do
- before do
- @set = @evaluator.evaluate('a/ns1:*')
- end
-
- it_behaves_like :node_set, :length => 1
-
- example 'include the correct node' do
- @set[0].name.should == 'c'
- @set[0].namespace.name.should == 'ns1'
- end
- end
-
- context 'name and namespace wildcards' do
- before do
- @set = @evaluator.evaluate('a/*:*')
- end
-
- it_behaves_like :node_set, :length => 3
-
- example 'include the first node' do
- @set[0].name.should == 'b'
- end
-
- example 'include the second node' do
- @set[1].name.should == 'b'
- end
-
- example 'include the node' do
- @set[2].name.should == 'c'
+ example 'evaluate a containing a namespace wildcard and a name wildcard' do
+ evaluate_xpath(@document, 'a/*:*').should == @a1.children
end
end
end