diff --git a/spec/oga/css/evaluator/axes_spec.rb b/spec/oga/css/evaluator/axes_spec.rb
index 3990767..d73667a 100644
--- a/spec/oga/css/evaluator/axes_spec.rb
+++ b/spec/oga/css/evaluator/axes_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context 'axes' do
- context '> axis' do
+ describe 'axes' do
+ describe '> axis' do
before do
@document = parse('')
@a1 = @document.children[0].children[0]
end
- example 'return a node set containing direct child nodes' do
+ it 'returns a node set containing direct child nodes' do
evaluate_css(@document, 'root > a').should == node_set(@a1)
end
- example 'return a node set containing direct child nodes relative to a node' do
+ it 'returns a node set containing direct child nodes relative to a node' do
evaluate_css(@a1, '> a').should == @a1.children
end
- example 'return an empty node set for non matching child nodes' do
+ it 'returns an empty node set for non matching child nodes' do
evaluate_css(@document, '> a').should == node_set
end
end
- context '+ axis' do
+ describe '+ axis' do
before do
@document = parse('')
@@ -30,20 +30,20 @@ describe 'CSS selector evaluation' do
@b2 = @document.children[0].children[2]
end
- example 'return a node set containing following siblings' do
+ it 'returns a node set containing following siblings' do
evaluate_css(@document, 'root a + b').should == node_set(@b1)
end
- example 'return a node set containing following siblings relatie to a node' do
+ it 'returns a node set containing following siblings relatie to a node' do
evaluate_css(@b1, '+ b').should == node_set(@b2)
end
- example 'return an empty node set for non matching following siblings' do
+ it 'returns an empty node set for non matching following siblings' do
evaluate_css(@document, 'root a + c').should == node_set
end
end
- context '~ axis' do
+ describe '~ axis' do
before do
@document = parse('')
@@ -51,15 +51,15 @@ describe 'CSS selector evaluation' do
@b2 = @document.children[0].children[2]
end
- example 'return a node set containing following siblings' do
+ it 'returns a node set containing following siblings' do
evaluate_css(@document, 'root a ~ b').should == node_set(@b1, @b2)
end
- example 'return a node set containing following siblings relative to a node' do
+ it 'returns a node set containing following siblings relative to a node' do
evaluate_css(@b1, '~ b').should == node_set(@b2)
end
- example 'return an empty node set for non matching following siblings' do
+ it 'returns an empty node set for non matching following siblings' do
evaluate_css(@document, 'root a ~ c').should == node_set
end
end
diff --git a/spec/oga/css/evaluator/classes_spec.rb b/spec/oga/css/evaluator/classes_spec.rb
index b16b6cd..c532212 100644
--- a/spec/oga/css/evaluator/classes_spec.rb
+++ b/spec/oga/css/evaluator/classes_spec.rb
@@ -1,26 +1,26 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context 'classes' do
- example 'return a node set containing a node with a single class' do
+ describe 'classes' do
+ it 'returns a node set containing a node with a single class' do
document = parse('')
evaluate_css(document, '.foo').should == document.children
end
- example 'return a node set containing a node having one of two classes' do
+ it 'returns a node set containing a node having one of two classes' do
document = parse('')
evaluate_css(document, '.foo').should == document.children
end
- example 'return a node set containing a node having both classes' do
+ it 'returns a node set containing a node having both classes' do
document = parse('')
evaluate_css(document, '.foo.bar').should == document.children
end
- example 'return an empty node set for non matching classes' do
+ it 'returns an empty node set for non matching classes' do
document = parse('')
evaluate_css(document, '.foo').should == node_set
diff --git a/spec/oga/css/evaluator/ids_spec.rb b/spec/oga/css/evaluator/ids_spec.rb
index cc4a17c..10fd55f 100644
--- a/spec/oga/css/evaluator/ids_spec.rb
+++ b/spec/oga/css/evaluator/ids_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context 'IDs' do
+ describe 'IDs' do
before do
@document = parse('')
end
- example 'return a node set containing a node with a single ID' do
+ it 'returns a node set containing a node with a single ID' do
evaluate_css(@document, '#foo').should == @document.children
end
- example 'return an empty node set for non matching IDs' do
+ it 'returns an empty node set for non matching IDs' do
evaluate_css(@document, '#bar').should == node_set
end
end
diff --git a/spec/oga/css/evaluator/operators_spec.rb b/spec/oga/css/evaluator/operators_spec.rb
index 459673f..6efdb4b 100644
--- a/spec/oga/css/evaluator/operators_spec.rb
+++ b/spec/oga/css/evaluator/operators_spec.rb
@@ -1,97 +1,97 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context 'operators' do
- context '= operator' do
+ describe 'operators' do
+ describe '= operator' do
before do
@document = parse('')
end
- example 'return a node set containing nodes with matching attributes' do
+ it 'returns a node set containing nodes with matching attributes' do
evaluate_css(@document, 'x[a = "b"]').should == @document.children
end
- example 'return an empty node set for non matching attribute values' do
+ it 'returns an empty node set for non matching attribute values' do
evaluate_css(@document, 'x[a = "c"]').should == node_set
end
end
- context '~= operator' do
- example 'return a node set containing nodes with matching attributes' do
+ describe '~= operator' do
+ it 'returns a node set containing nodes with matching attributes' do
document = parse('')
evaluate_css(document, 'x[a ~= "2"]').should == document.children
end
- example 'return a node set containing nodes with single attribute values' do
+ it 'returns a node set containing nodes with single attribute values' do
document = parse('')
evaluate_css(document, 'x[a ~= "1"]').should == document.children
end
- example 'return an empty node set for non matching attributes' do
+ it 'returns an empty node set for non matching attributes' do
document = parse('')
evaluate_css(document, 'x[a ~= "4"]').should == node_set
end
end
- context '^= operator' do
+ describe '^= operator' do
before do
@document = parse('')
end
- example 'return a node set containing nodes with matching attributes' do
+ it 'returns a node set containing nodes with matching attributes' do
evaluate_css(@document, 'x[a ^= "fo"]').should == @document.children
end
- example 'return an empty node set for non matching attributes' do
+ it 'returns an empty node set for non matching attributes' do
evaluate_css(@document, 'x[a ^= "bar"]').should == node_set
end
end
- context '$= operator' do
+ describe '$= operator' do
before do
@document = parse('')
end
- example 'return a node set containing nodes with matching attributes' do
+ it 'returns a node set containing nodes with matching attributes' do
evaluate_css(@document, 'x[a $= "oo"]').should == @document.children
end
- example 'return an empty node set for non matching attributes' do
+ it 'returns an empty node set for non matching attributes' do
evaluate_css(@document, 'x[a $= "x"]').should == node_set
end
end
- context '*= operator' do
+ describe '*= operator' do
before do
@document = parse('')
end
- example 'return a node set containing nodes with matching attributes' do
+ it 'returns a node set containing nodes with matching attributes' do
evaluate_css(@document, 'x[a *= "o"]').should == @document.children
end
- example 'return an empty node set for non matching attributes' do
+ it 'returns an empty node set for non matching attributes' do
evaluate_css(@document, 'x[a *= "x"]').should == node_set
end
end
- context '|= operator' do
- example 'return a node set containing nodes with matching attributes' do
+ describe '|= operator' do
+ it 'returns a node set containing nodes with matching attributes' do
document = parse('')
evaluate_css(document, 'x[a |= "foo"]').should == document.children
end
- example 'return a node set containing nodes with single attribute values' do
+ it 'returns a node set containing nodes with single attribute values' do
document = parse('')
evaluate_css(document, 'x[a |= "foo"]').should == document.children
end
- example 'return an empty node set for non matching attributes' do
+ it 'returns an empty node set for non matching attributes' do
document = parse('')
evaluate_css(document, 'x[a |= "foo"]').should == node_set
diff --git a/spec/oga/css/evaluator/paths_spec.rb b/spec/oga/css/evaluator/paths_spec.rb
index 1b2f9e2..1871c7b 100644
--- a/spec/oga/css/evaluator/paths_spec.rb
+++ b/spec/oga/css/evaluator/paths_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context 'paths' do
+ describe 'paths' do
before do
@document = parse('')
@@ -11,31 +11,31 @@ describe 'CSS selector evaluation' do
@c1 = @a1.children[2]
end
- example 'return a node set containing the root node' do
+ it 'returns a node set containing the root node' do
evaluate_css(@document, 'a').should == node_set(@a1)
end
- example 'return a node set containing nested nodes' do
+ it 'returns a node set containing nested nodes' do
evaluate_css(@document, 'a b').should == node_set(@b1, @b2)
end
- example 'return a node set containing namespaced nodes' do
+ it 'returns a node set containing namespaced nodes' do
evaluate_css(@document, 'a ns1|c').should == node_set(@c1)
end
- example 'return a node set containing wildcard nodes' do
+ it 'returns a node set containing wildcard nodes' do
evaluate_css(@document, 'a *').should == node_set(@b1, @b2, @c1)
end
- example 'return a node set containing nodes with namespace wildcards' do
+ it 'returns a node set containing nodes with namespace wildcards' do
evaluate_css(@document, 'a *|c')
end
- example 'return a node set containing nodes with a namespace name and name wildcard' do
+ it 'returns a node set containing nodes with a namespace name and name wildcard' do
evaluate_css(@document, 'a ns1|*').should == node_set(@c1)
end
- example 'return a node set containing nodes using full wildcards' do
+ it 'returns a node set containing nodes using full wildcards' do
evaluate_css(@document, 'a *|*').should == node_set(@b1, @b2, @c1)
end
end
diff --git a/spec/oga/css/evaluator/predicates_spec.rb b/spec/oga/css/evaluator/predicates_spec.rb
index b6bf477..8159439 100644
--- a/spec/oga/css/evaluator/predicates_spec.rb
+++ b/spec/oga/css/evaluator/predicates_spec.rb
@@ -1,18 +1,18 @@
require 'spec_helper'
-context 'CSS selector evaluation' do
- context 'predicates' do
+describe 'CSS selector evaluation' do
+ describe 'predicates' do
before do
@document = parse('')
@a1 = @document.children[0].children[0]
end
- example 'return a node set containing nodes with an attribute' do
+ it 'returns a node set containing nodes with an attribute' do
evaluate_css(@document, 'root a[class]').should == node_set(@a1)
end
- example 'return a node set containing nodes with a matching attribute value' do
+ it 'returns a node set containing nodes with a matching attribute value' do
evaluate_css(@document, 'root a[class="foo"]').should == node_set(@a1)
end
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/empty_spec.rb b/spec/oga/css/evaluator/pseudo_classes/empty_spec.rb
index a41010e..6d519cc 100644
--- a/spec/oga/css/evaluator/pseudo_classes/empty_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/empty_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':empty pseudo class' do
+ describe ':empty pseudo class' do
before do
@document = parse('foo')
@@ -9,15 +9,15 @@ describe 'CSS selector evaluation' do
@b1 = @document.children[0].children[1]
end
- example 'return a node set containing empty nodes' do
+ it 'returns a node set containing empty nodes' do
evaluate_css(@document, 'root :empty').should == node_set(@a1)
end
- example 'return a node set containing empty nodes with a node test' do
+ it 'returns a node set containing empty nodes with a node test' do
evaluate_css(@document, 'root a:empty').should == node_set(@a1)
end
- example 'return an empty node set containing non empty nodes' do
+ it 'returns an empty node set containing non empty nodes' do
evaluate_css(@document, 'root b:empty').should == node_set
end
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/first_child_spec.rb b/spec/oga/css/evaluator/pseudo_classes/first_child_spec.rb
index 1909861..37d3cce 100644
--- a/spec/oga/css/evaluator/pseudo_classes/first_child_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/first_child_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':first-child pseudo class' do
+ describe ':first-child pseudo class' do
before do
@document = parse('')
@@ -9,15 +9,15 @@ describe 'CSS selector evaluation' do
@b1 = @document.children[0].children[1]
end
- example 'return a node set containing the first child node' do
+ it 'returns a node set containing the first child node' do
evaluate_css(@document, 'root :first-child').should == node_set(@a1)
end
- example 'return a node set containing the first child node with a node test' do
+ it 'returns a node set containing the first child node with a node test' do
evaluate_css(@document, 'root a:first-child').should == node_set(@a1)
end
- example 'return an empty node set for non first-child nodes' do
+ it 'returns an empty node set for non first-child nodes' do
evaluate_css(@document, 'root b:first-child').should == node_set
end
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb
index 37c8891..99d0498 100644
--- a/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':first-of-type pseudo class' do
+ describe ':first-of-type pseudo class' do
before do
@document = parse(<<-EOF)
@@ -17,7 +17,7 @@ describe 'CSS selector evaluation' do
@a3 = @document.at_xpath('root/a[2]/a[1]')
end
- example 'return a node set containing all first nodes' do
+ it 'returns a node set containing all first nodes' do
evaluate_css(@document, 'root a:first-of-type')
.should == node_set(@a1, @a3)
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/last_child_spec.rb b/spec/oga/css/evaluator/pseudo_classes/last_child_spec.rb
index 7ffe1cf..09edf7a 100644
--- a/spec/oga/css/evaluator/pseudo_classes/last_child_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/last_child_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':last-child pseudo class' do
+ describe ':last-child pseudo class' do
before do
@document = parse('')
@@ -9,15 +9,15 @@ describe 'CSS selector evaluation' do
@b1 = @document.children[0].children[1]
end
- example 'return a node set containing the last child node' do
+ it 'returns a node set containing the last child node' do
evaluate_css(@document, 'root :last-child').should == node_set(@b1)
end
- example 'return a node set containing the last child node with a node test' do
+ it 'returns a node set containing the last child node with a node test' do
evaluate_css(@document, 'root b:last-child').should == node_set(@b1)
end
- example 'return an empty node set for non last-child nodes' do
+ it 'returns an empty node set for non last-child nodes' do
evaluate_css(@document, 'root a:last-child').should == node_set
end
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb
index 8ed2102..9fa1852 100644
--- a/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':last-of-type pseudo class' do
+ describe ':last-of-type pseudo class' do
before do
@document = parse(<<-EOF)
@@ -17,7 +17,7 @@ describe 'CSS selector evaluation' do
@a4 = @document.at_xpath('root/a[2]/a[2]')
end
- example 'return a node set containing all last nodes' do
+ it 'returns a node set containing all last nodes' do
evaluate_css(@document, 'root a:last-of-type')
.should == node_set(@a2, @a4)
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_child_spec.rb b/spec/oga/css/evaluator/pseudo_classes/nth_child_spec.rb
index a3edfcf..47a6b46 100644
--- a/spec/oga/css/evaluator/pseudo_classes/nth_child_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/nth_child_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':nth-child pseudo class' do
+ describe ':nth-child pseudo class' do
before do
@document = parse('')
@@ -12,35 +12,35 @@ describe 'CSS selector evaluation' do
@a4 = @root.children[3]
end
- example 'return a node set containing the first child node' do
+ it 'returns a node set containing the first child node' do
evaluate_css(@document, 'root :nth-child(1)').should == node_set(@a1)
end
- example 'return a node set containing even nodes' do
+ it 'returns a node set containing even nodes' do
evaluate_css(@document, 'root :nth-child(even)')
.should == node_set(@a2, @a4)
end
- example 'return a node set containing odd nodes' do
+ it 'returns a node set containing odd nodes' do
evaluate_css(@document, 'root :nth-child(odd)')
.should == node_set(@a1, @a3)
end
- example 'return a node set containing every 2 nodes starting at node 2' do
+ it 'returns a node set containing every 2 nodes starting at node 2' do
evaluate_css(@document, 'root :nth-child(2n+2)')
.should == node_set(@a2, @a4)
end
- example 'return a node set containing all nodes' do
+ it 'returns a node set containing all nodes' do
evaluate_css(@document, 'root :nth-child(n)').should == @root.children
end
- example 'return a node set containing the first two nodes' do
+ it 'returns a node set containing the first two nodes' do
evaluate_css(@document, 'root :nth-child(-n+2)')
.should == node_set(@a1, @a2)
end
- example 'return a node set containing all nodes starting at node 2' do
+ it 'returns a node set containing all nodes starting at node 2' do
evaluate_css(@document, 'root :nth-child(n+2)')
.should == node_set(@a2, @a3, @a4)
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_last_child_spec.rb b/spec/oga/css/evaluator/pseudo_classes/nth_last_child_spec.rb
index 86bf26b..6a91088 100644
--- a/spec/oga/css/evaluator/pseudo_classes/nth_last_child_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/nth_last_child_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':nth-last-child pseudo class' do
+ describe ':nth-last-child pseudo class' do
before do
@document = parse('')
@@ -12,36 +12,36 @@ describe 'CSS selector evaluation' do
@a4 = @root.children[3]
end
- example 'return a node set containing the last child node' do
+ it 'returns a node set containing the last child node' do
evaluate_css(@document, 'root :nth-last-child(1)').should == node_set(@a4)
end
- example 'return a node set containing even nodes' do
+ it 'returns a node set containing even nodes' do
evaluate_css(@document, 'root :nth-last-child(even)')
.should == node_set(@a1, @a3)
end
- example 'return a node set containing odd nodes' do
+ it 'returns a node set containing odd nodes' do
evaluate_css(@document, 'root :nth-last-child(odd)')
.should == node_set(@a2, @a4)
end
- example 'return a node set containing every 2 nodes starting at node 3' do
+ it 'returns a node set containing every 2 nodes starting at node 3' do
evaluate_css(@document, 'root :nth-last-child(2n+2)')
.should == node_set(@a1, @a3)
end
- example 'return a node set containing all nodes' do
+ it 'returns a node set containing all nodes' do
evaluate_css(@document, 'root :nth-last-child(n)')
.should == @root.children
end
- example 'return a node set containing the first two nodes' do
+ it 'returns a node set containing the first two nodes' do
evaluate_css(@document, 'root :nth-last-child(-n+2)')
.should == node_set(@a3, @a4)
end
- example 'return a node set containing all nodes starting at node 2' do
+ it 'returns a node set containing all nodes starting at node 2' do
evaluate_css(@document, 'root :nth-last-child(n+2)')
.should == node_set(@a1, @a2, @a3)
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_last_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/nth_last_of_type_spec.rb
index 411ec2d..c9e8217 100644
--- a/spec/oga/css/evaluator/pseudo_classes/nth_last_of_type_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/nth_last_of_type_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':nth-last-of-type pseudo class' do
+ describe ':nth-last-of-type pseudo class' do
before do
@document = parse(<<-EOF.strip)
@@ -21,37 +21,37 @@ describe 'CSS selector evaluation' do
@a4 = @root.at_xpath('b/a')
end
- example 'return a node set containing the first child node' do
+ it 'returns a node set containing the first child node' do
evaluate_css(@document, 'root a:nth-last-of-type(1)')
.should == node_set(@a3, @a4)
end
- example 'return a node set containing even nodes' do
+ it 'returns a node set containing even nodes' do
evaluate_css(@document, 'root a:nth-last-of-type(even)')
.should == node_set(@a2)
end
- example 'return a node set containing odd nodes' do
+ it 'returns a node set containing odd nodes' do
evaluate_css(@document, 'root a:nth-last-of-type(odd)')
.should == node_set(@a1, @a3, @a4)
end
- example 'return a node set containing every 2 nodes starting at node 2' do
+ it 'returns a node set containing every 2 nodes starting at node 2' do
evaluate_css(@document, 'root a:nth-last-of-type(2n+2)')
.should == node_set(@a2)
end
- example 'return a node set containing all nodes' do
+ it 'returns a node set containing all nodes' do
evaluate_css(@document, 'root a:nth-last-of-type(n)')
.should == node_set(@a1, @a2, @a3, @a4)
end
- example 'return a node set containing the first two nodes' do
+ it 'returns a node set containing the first two nodes' do
evaluate_css(@document, 'root a:nth-last-of-type(-n+2)')
.should == node_set(@a2, @a3, @a4)
end
- example 'return a node set containing all nodes starting at node 2' do
+ it 'returns a node set containing all nodes starting at node 2' do
evaluate_css(@document, 'root a:nth-last-of-type(n+2)')
.should == node_set(@a1, @a2)
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/nth_of_type_spec.rb
index aec5266..b1a8994 100644
--- a/spec/oga/css/evaluator/pseudo_classes/nth_of_type_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/nth_of_type_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':nth-of-type pseudo class' do
+ describe ':nth-of-type pseudo class' do
before do
@document = parse(<<-EOF.strip)
@@ -21,37 +21,37 @@ describe 'CSS selector evaluation' do
@a4 = @root.at_xpath('b/a')
end
- example 'return a node set containing the first child node' do
+ it 'returns a node set containing the first child node' do
evaluate_css(@document, 'root a:nth-of-type(1)')
.should == node_set(@a1, @a4)
end
- example 'return a node set containing even nodes' do
+ it 'returns a node set containing even nodes' do
evaluate_css(@document, 'root a:nth-of-type(even)')
.should == node_set(@a2)
end
- example 'return a node set containing odd nodes' do
+ it 'returns a node set containing odd nodes' do
evaluate_css(@document, 'root a:nth-of-type(odd)')
.should == node_set(@a1, @a3, @a4)
end
- example 'return a node set containing every 2 nodes starting at node 2' do
+ it 'returns a node set containing every 2 nodes starting at node 2' do
evaluate_css(@document, 'root a:nth-of-type(2n+2)')
.should == node_set(@a2)
end
- example 'return a node set containing all nodes' do
+ it 'returns a node set containing all nodes' do
evaluate_css(@document, 'root a:nth-of-type(n)')
.should == node_set(@a1, @a2, @a3, @a4)
end
- example 'return a node set containing the first two nodes' do
+ it 'returns a node set containing the first two nodes' do
evaluate_css(@document, 'root a:nth-of-type(-n+2)')
.should == node_set(@a1, @a2, @a4)
end
- example 'return a node set containing all nodes starting at node 2' do
+ it 'returns a node set containing all nodes starting at node 2' do
evaluate_css(@document, 'root a:nth-of-type(n+2)')
.should == node_set(@a2, @a3)
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb b/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb
index d83f540..0695df4 100644
--- a/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':only-child pseudo class' do
+ describe ':only-child pseudo class' do
before do
@document = parse('')
@@ -10,7 +10,7 @@ describe 'CSS selector evaluation' do
@c2 = @root.children[1].children[0]
end
- example 'return a node set containing nodes' do
+ it 'returns a node set containing nodes' do
evaluate_css(@document, 'root :only-child').should == node_set(@c1, @c2)
end
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb
index 8a21230..4e83e6c 100644
--- a/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':only-of-type pseudo class' do
+ describe ':only-of-type pseudo class' do
before do
@document = parse('')
@@ -10,7 +10,7 @@ describe 'CSS selector evaluation' do
@c2 = @root.children[1].children[0]
end
- example 'return a node set containing nodes' do
+ it 'returns a node set containing nodes' do
evaluate_css(@document, 'root a :only-of-type').should == node_set(@c1)
end
end
diff --git a/spec/oga/css/evaluator/pseudo_classes/root_spec.rb b/spec/oga/css/evaluator/pseudo_classes/root_spec.rb
index f045f6e..9686301 100644
--- a/spec/oga/css/evaluator/pseudo_classes/root_spec.rb
+++ b/spec/oga/css/evaluator/pseudo_classes/root_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
- context ':root pseudo class' do
+ describe ':root pseudo class' do
before do
@document = parse('')
end
- example 'return a node set containing the root node' do
+ it 'returns a node set containing the root node' do
evaluate_css(@document, ':root').should == @document.children
end
end
diff --git a/spec/oga/css/lexer/axes_spec.rb b/spec/oga/css/lexer/axes_spec.rb
index 2aa5431..7833a99 100644
--- a/spec/oga/css/lexer/axes_spec.rb
+++ b/spec/oga/css/lexer/axes_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'axes' do
- example 'lex the > axis' do
+ describe 'axes' do
+ it 'lexes the > axis' do
lex_css('>').should == [[:T_GREATER, nil]]
end
- example 'lex the expression "> y"' do
+ it 'lexes the expression "> y"' do
lex_css('> y').should == [[:T_GREATER, nil], [:T_IDENT, 'y']]
end
- example 'lex the expression "x > y"' do
+ it 'lexes the expression "x > y"' do
lex_css('x > y').should == [
[:T_IDENT, 'x'],
[:T_SPACE, nil],
@@ -19,15 +19,15 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the + axis' do
+ it 'lexes the + axis' do
lex_css('+').should == [[:T_PLUS, nil]]
end
- example 'lex the expression "+ y"' do
+ it 'lexes the expression "+ y"' do
lex_css('+ y').should == [[:T_PLUS, nil], [:T_IDENT, 'y']]
end
- example 'lex the expression "x + y"' do
+ it 'lexes the expression "x + y"' do
lex_css('x + y').should == [
[:T_IDENT, 'x'],
[:T_SPACE, nil],
@@ -36,15 +36,15 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the ~ axis' do
+ it 'lexes the ~ axis' do
lex_css('~').should == [[:T_TILDE, nil]]
end
- example 'lex the expression "~ y"' do
+ it 'lexes the expression "~ y"' do
lex_css('~ y').should == [[:T_TILDE, nil], [:T_IDENT, 'y']]
end
- example 'lex the expression "x ~ y"' do
+ it 'lexes the expression "x ~ y"' do
lex_css('x ~ y').should == [
[:T_IDENT, 'x'],
[:T_SPACE, nil],
diff --git a/spec/oga/css/lexer/namespaces_spec.rb b/spec/oga/css/lexer/namespaces_spec.rb
index b65785e..2c881bf 100644
--- a/spec/oga/css/lexer/namespaces_spec.rb
+++ b/spec/oga/css/lexer/namespaces_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'namespaces' do
- example 'lex a path containing a namespace name' do
+ describe 'namespaces' do
+ it 'lexes a path containing a namespace name' do
lex_css('foo|bar').should == [
[:T_IDENT, 'foo'],
[:T_PIPE, nil],
@@ -10,7 +10,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex a path containing a namespace wildcard' do
+ it 'lexes a path containing a namespace wildcard' do
lex_css('*|foo').should == [
[:T_IDENT, '*'],
[:T_PIPE, nil],
diff --git a/spec/oga/css/lexer/operators_spec.rb b/spec/oga/css/lexer/operators_spec.rb
index 29ee2c3..9ed9ca7 100644
--- a/spec/oga/css/lexer/operators_spec.rb
+++ b/spec/oga/css/lexer/operators_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'operators' do
- example 'lex the = operator' do
+ describe 'operators' do
+ it 'lexes the = operator' do
lex_css('[=]').should == [
[:T_LBRACK, nil],
[:T_EQ, nil],
@@ -10,7 +10,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the ~= operator' do
+ it 'lexes the ~= operator' do
lex_css('[~=]').should == [
[:T_LBRACK, nil],
[:T_SPACE_IN, nil],
@@ -18,7 +18,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the ^= operator' do
+ it 'lexes the ^= operator' do
lex_css('[^=]').should == [
[:T_LBRACK, nil],
[:T_STARTS_WITH, nil],
@@ -26,7 +26,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the $= operator' do
+ it 'lexes the $= operator' do
lex_css('[$=]').should == [
[:T_LBRACK, nil],
[:T_ENDS_WITH, nil],
@@ -34,7 +34,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the *= operator' do
+ it 'lexes the *= operator' do
lex_css('[*=]').should == [
[:T_LBRACK, nil],
[:T_IN, nil],
@@ -42,7 +42,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex an identifier followed by the *= operator' do
+ it 'lexes an identifier followed by the *= operator' do
lex_css('[foo *=]').should == [
[:T_LBRACK, nil],
[:T_IDENT, 'foo'],
@@ -51,7 +51,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the |= operator' do
+ it 'lexes the |= operator' do
lex_css('[|=]').should == [
[:T_LBRACK, nil],
[:T_HYPHEN_IN, nil],
diff --git a/spec/oga/css/lexer/paths_spec.rb b/spec/oga/css/lexer/paths_spec.rb
index 9bc3183..de7c3d3 100644
--- a/spec/oga/css/lexer/paths_spec.rb
+++ b/spec/oga/css/lexer/paths_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'paths' do
- example 'lex a simple path' do
+ describe 'paths' do
+ it 'lexes a simple path' do
lex_css('h3').should == [[:T_IDENT, 'h3']]
end
- example 'lex a simple path starting with an underscore' do
+ it 'lexes a simple path starting with an underscore' do
lex_css('_h3').should == [[:T_IDENT, '_h3']]
end
- example 'lex a path with two members' do
+ it 'lexes a path with two members' do
lex_css('div h3').should == [
[:T_IDENT, 'div'],
[:T_SPACE, nil],
@@ -18,7 +18,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex a path with two members separated by multiple spaces' do
+ it 'lexes a path with two members separated by multiple spaces' do
lex_css('div h3').should == [
[:T_IDENT, 'div'],
[:T_SPACE, nil],
@@ -26,7 +26,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex two paths' do
+ it 'lexes two paths' do
lex_css('foo, bar').should == [
[:T_IDENT, 'foo'],
[:T_COMMA, nil],
@@ -34,21 +34,21 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex a path selecting an ID' do
+ it 'lexes a path selecting an ID' do
lex_css('#foo').should == [
[:T_HASH, nil],
[:T_IDENT, 'foo']
]
end
- example 'lex a path selecting a class' do
+ it 'lexes a path selecting a class' do
lex_css('.foo').should == [
[:T_DOT, nil],
[:T_IDENT, 'foo']
]
end
- example 'lex a wildcard path' do
+ it 'lexes a wildcard path' do
lex_css('*').should == [[:T_IDENT, '*']]
end
end
diff --git a/spec/oga/css/lexer/predicates_spec.rb b/spec/oga/css/lexer/predicates_spec.rb
index 53438a4..92d917c 100644
--- a/spec/oga/css/lexer/predicates_spec.rb
+++ b/spec/oga/css/lexer/predicates_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'predicates' do
- example 'lex a path containing a simple predicate' do
+ describe 'predicates' do
+ it 'lexes a path containing a simple predicate' do
lex_css('foo[bar]').should == [
[:T_IDENT, 'foo'],
[:T_LBRACK, nil],
diff --git a/spec/oga/css/lexer/pseudo_classes_spec.rb b/spec/oga/css/lexer/pseudo_classes_spec.rb
index c075588..fac944d 100644
--- a/spec/oga/css/lexer/pseudo_classes_spec.rb
+++ b/spec/oga/css/lexer/pseudo_classes_spec.rb
@@ -1,15 +1,15 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'pseudo classes' do
- example 'lex the :root pseudo class' do
+ describe 'pseudo classes' do
+ it 'lexes the :root pseudo class' do
lex_css(':root').should == [
[:T_COLON, nil],
[:T_IDENT, 'root']
]
end
- example 'lex the :nth-child pseudo class' do
+ it 'lexes the :nth-child pseudo class' do
lex_css(':nth-child(1)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -19,7 +19,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child pseudo class with extra whitespace' do
+ it 'lexes the :nth-child pseudo class with extra whitespace' do
lex_css(':nth-child( 1)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -29,7 +29,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(odd) pseudo class' do
+ it 'lexes the :nth-child(odd) pseudo class' do
lex_css(':nth-child(odd)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -39,7 +39,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(even) pseudo class' do
+ it 'lexes the :nth-child(even) pseudo class' do
lex_css(':nth-child(even)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -49,7 +49,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(n) pseudo class' do
+ it 'lexes the :nth-child(n) pseudo class' do
lex_css(':nth-child(n)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -59,7 +59,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(-n) pseudo class' do
+ it 'lexes the :nth-child(-n) pseudo class' do
lex_css(':nth-child(-n)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -70,7 +70,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(2n) pseudo class' do
+ it 'lexes the :nth-child(2n) pseudo class' do
lex_css(':nth-child(2n)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -81,7 +81,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(2n+1) pseudo class' do
+ it 'lexes the :nth-child(2n+1) pseudo class' do
lex_css(':nth-child(2n+1)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -93,7 +93,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(2n-1) pseudo class' do
+ it 'lexes the :nth-child(2n-1) pseudo class' do
lex_css(':nth-child(2n-1)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -105,7 +105,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :nth-child(-2n-1) pseudo class' do
+ it 'lexes the :nth-child(-2n-1) pseudo class' do
lex_css(':nth-child(-2n-1)').should == [
[:T_COLON, nil],
[:T_IDENT, 'nth-child'],
@@ -117,7 +117,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex the :lang(fr) pseudo class' do
+ it 'lexes the :lang(fr) pseudo class' do
lex_css(':lang(fr)').should == [
[:T_COLON, nil],
[:T_IDENT, 'lang'],
diff --git a/spec/oga/css/lexer/strings_spec.rb b/spec/oga/css/lexer/strings_spec.rb
index 20bd62c..1c782f5 100644
--- a/spec/oga/css/lexer/strings_spec.rb
+++ b/spec/oga/css/lexer/strings_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
- context 'strings' do
- example 'lex a single quoted string' do
+ describe 'strings' do
+ it 'lexes a single quoted string' do
lex_css("['foo']").should == [
[:T_LBRACK, nil],
[:T_STRING, 'foo'],
@@ -10,7 +10,7 @@ describe Oga::CSS::Lexer do
]
end
- example 'lex a double quoted string' do
+ it 'lexes a double quoted string' do
lex_css('["foo"]').should == [
[:T_LBRACK, nil],
[:T_STRING, 'foo'],
diff --git a/spec/oga/css/parser/axes_spec.rb b/spec/oga/css/parser/axes_spec.rb
index aef6330..6b66b91 100644
--- a/spec/oga/css/parser/axes_spec.rb
+++ b/spec/oga/css/parser/axes_spec.rb
@@ -1,53 +1,53 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'axes' do
- example 'parse the > axis' do
+ describe 'axes' do
+ it 'parses the > axis' do
parse_css('x > y').should == parse_xpath('descendant::x/y')
end
- example 'parse the > axis called on another > axis' do
+ it 'parses the > axis called on another > axis' do
parse_css('a > b > c').should == parse_xpath('descendant::a/b/c')
end
- example 'parse an > axis followed by an element with an ID' do
+ it 'parses an > axis followed by an element with an ID' do
parse_css('x > foo#bar').should == parse_xpath(
'descendant::x/foo[@id="bar"]'
)
end
- example 'parse an > axis followed by an element with a class' do
+ it 'parses an > axis followed by an element with a class' do
parse_css('x > foo.bar').should == parse_xpath(
'descendant::x/foo[contains(concat(" ", @class, " "), " bar ")]'
)
end
- example 'parse the + axis' do
+ it 'parses the + axis' do
parse_css('x + y').should == parse_xpath(
'descendant::x/following-sibling::*[1]/self::y'
)
end
- example 'parse the + axis called on another + axis' do
+ it 'parses the + axis called on another + axis' do
parse_css('a + b + c').should == parse_xpath(
'descendant::a/following-sibling::*[1]/self::b/' \
'following-sibling::*[1]/self::c'
)
end
- example 'parse the ~ axis' do
+ it 'parses the ~ axis' do
parse_css('x ~ y').should == parse_xpath(
'descendant::x/following-sibling::y'
)
end
- example 'parse the ~ axis followed by another node test' do
+ it 'parses the ~ axis followed by another node test' do
parse_css('x ~ y z').should == parse_xpath(
'descendant::x/following-sibling::y/descendant::z'
)
end
- example 'parse the ~ axis called on another ~ axis' do
+ it 'parses the ~ axis called on another ~ axis' do
parse_css('a ~ b ~ c').should == parse_xpath(
'descendant::a/following-sibling::b/following-sibling::c'
)
diff --git a/spec/oga/css/parser/classes_spec.rb b/spec/oga/css/parser/classes_spec.rb
index 5700b3a..1bd41ff 100644
--- a/spec/oga/css/parser/classes_spec.rb
+++ b/spec/oga/css/parser/classes_spec.rb
@@ -1,27 +1,27 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'classes' do
- example 'parse a class selector' do
+ describe 'classes' do
+ it 'parses a class selector' do
parse_css('.foo').should == parse_xpath(
'descendant::*[contains(concat(" ", @class, " "), " foo ")]'
)
end
- example 'parse a selector for an element with a class' do
+ it 'parses a selector for an element with a class' do
parse_css('foo.bar').should == parse_xpath(
'descendant::foo[contains(concat(" ", @class, " "), " bar ")]'
)
end
- example 'parse a selector using multiple classes' do
+ it 'parses a selector using multiple classes' do
parse_css('.foo.bar').should == parse_xpath(
'descendant::*[contains(concat(" ", @class, " "), " foo ") ' \
'and contains(concat(" ", @class, " "), " bar ")]'
)
end
- example 'parse a selector using a class and an ID' do
+ it 'parses a selector using a class and an ID' do
parse_css('#foo.bar').should == parse_xpath(
'descendant::*[@id="foo" and ' \
'contains(concat(" ", @class, " "), " bar ")]'
diff --git a/spec/oga/css/parser/ids_spec.rb b/spec/oga/css/parser/ids_spec.rb
index 7fba027..63f53f7 100644
--- a/spec/oga/css/parser/ids_spec.rb
+++ b/spec/oga/css/parser/ids_spec.rb
@@ -1,22 +1,22 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'IDs' do
- example 'parse an ID selector' do
+ describe 'IDs' do
+ it 'parses an ID selector' do
parse_css('#foo').should == parse_xpath('descendant::*[@id="foo"]')
end
- example 'parse a selector for an element with an ID' do
+ it 'parses a selector for an element with an ID' do
parse_css('foo#bar').should == parse_xpath('descendant::foo[@id="bar"]')
end
- example 'parse a selector using multiple IDs' do
+ it 'parses a selector using multiple IDs' do
parse_css('#foo#bar').should == parse_xpath(
'descendant::*[@id="foo" and @id="bar"]'
)
end
- example 'parse a selector using an ID and a class' do
+ it 'parses a selector using an ID and a class' do
parse_css('.foo#bar').should == parse_xpath(
'descendant::*[contains(concat(" ", @class, " "), " foo ") ' \
'and @id="bar"]'
diff --git a/spec/oga/css/parser/operators_spec.rb b/spec/oga/css/parser/operators_spec.rb
index 9bf059d..4dfb4fc 100644
--- a/spec/oga/css/parser/operators_spec.rb
+++ b/spec/oga/css/parser/operators_spec.rb
@@ -1,38 +1,38 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'operators' do
- example 'parse the = operator' do
+ describe 'operators' do
+ it 'parses the = operator' do
parse_css('x[a="b"]').should == parse_xpath('descendant::x[@a="b"]')
end
- example 'parse the ~= operator' do
+ it 'parses the ~= operator' do
parse_css('x[a~="b"]').should == parse_xpath(
'descendant::x[contains(concat(" ", @a, " "), ' \
'concat(" ", "b", " "))]'
)
end
- example 'parse the ^= operator' do
+ it 'parses the ^= operator' do
parse_css('x[a^="b"]').should == parse_xpath(
'descendant::x[starts-with(@a, "b")]'
)
end
- example 'parse the $= operator' do
+ it 'parses the $= operator' do
parse_css('x[a$="b"]').should == parse_xpath(
'descendant::x[substring(@a, string-length(@a) - ' \
'string-length("b") + 1, string-length("b")) = "b"]'
)
end
- example 'parse the *= operator' do
+ it 'parses the *= operator' do
parse_css('x[a*="b"]').should == parse_xpath(
'descendant::x[contains(@a, "b")]'
)
end
- example 'parse the |= operator' do
+ it 'parses the |= operator' do
parse_css('x[a|="b"]').should == parse_xpath(
'descendant::x[@a = "b" or starts-with(@a, concat("b", "-"))]'
)
diff --git a/spec/oga/css/parser/paths_spec.rb b/spec/oga/css/parser/paths_spec.rb
index 96a5695..6ca297f 100644
--- a/spec/oga/css/parser/paths_spec.rb
+++ b/spec/oga/css/parser/paths_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'paths' do
- example 'parse a single path' do
+ describe 'paths' do
+ it 'parses a single path' do
parse_css('foo').should == parse_xpath('descendant::foo')
end
- example 'parse a path using a namespace' do
+ it 'parses a path using a namespace' do
parse_css('ns|foo').should == parse_xpath('descendant::ns:foo')
end
- example 'parse a path using two selectors' do
+ it 'parses a path using two selectors' do
parse_css('foo bar').should == parse_xpath(
'descendant::foo/descendant::bar'
)
diff --git a/spec/oga/css/parser/predicates_spec.rb b/spec/oga/css/parser/predicates_spec.rb
index a6214ad..1f558db 100644
--- a/spec/oga/css/parser/predicates_spec.rb
+++ b/spec/oga/css/parser/predicates_spec.rb
@@ -1,18 +1,18 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'predicates' do
- example 'parse a predicate' do
+ describe 'predicates' do
+ it 'parses a predicate' do
parse_css('foo[bar]').should == parse_xpath('descendant::foo[@bar]')
end
- example 'parse a node test followed by a node test with a predicate' do
+ it 'parses a node test followed by a node test with a predicate' do
parse_css('foo bar[baz]').should == parse_xpath(
'descendant::foo/descendant::bar[@baz]'
)
end
- example 'parse a predicate testing an attribute value' do
+ it 'parses a predicate testing an attribute value' do
parse_css('foo[bar="baz"]').should == parse_xpath(
'descendant::foo[@bar="baz"]'
)
diff --git a/spec/oga/css/parser/pseudo_classes/empty_spec.rb b/spec/oga/css/parser/pseudo_classes/empty_spec.rb
index c99749c..c5e5f62 100644
--- a/spec/oga/css/parser/pseudo_classes/empty_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/empty_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':empty pseudo class' do
- example 'parse the :empty pseudo class' do
+ describe ':empty pseudo class' do
+ it 'parses the :empty pseudo class' do
parse_css(':empty').should == parse_xpath('descendant::*[not(node())]')
end
end
diff --git a/spec/oga/css/parser/pseudo_classes/first_child_spec.rb b/spec/oga/css/parser/pseudo_classes/first_child_spec.rb
index 533edb6..c878907 100644
--- a/spec/oga/css/parser/pseudo_classes/first_child_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/first_child_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':first-child pseudo class' do
- example 'parse the :first-child pseudo class' do
+ describe ':first-child pseudo class' do
+ it 'parses the :first-child pseudo class' do
parse_css(':first-child').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 0]'
)
diff --git a/spec/oga/css/parser/pseudo_classes/first_of_type_spec.rb b/spec/oga/css/parser/pseudo_classes/first_of_type_spec.rb
index e228f45..fb0225b 100644
--- a/spec/oga/css/parser/pseudo_classes/first_of_type_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/first_of_type_spec.rb
@@ -1,14 +1,14 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':first-of-type pseudo class' do
- example 'parse the :first-of-type pseudo class' do
+ describe ':first-of-type pseudo class' do
+ it 'parses the :first-of-type pseudo class' do
parse_css(':first-of-type').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 0]'
)
end
- example 'parse the a:first-of-type pseudo class' do
+ it 'parses the a:first-of-type pseudo class' do
parse_css('a:first-of-type').should == parse_xpath(
'descendant::a[count(preceding-sibling::a) = 0]'
)
diff --git a/spec/oga/css/parser/pseudo_classes/last_child_spec.rb b/spec/oga/css/parser/pseudo_classes/last_child_spec.rb
index 13af10b..8201c31 100644
--- a/spec/oga/css/parser/pseudo_classes/last_child_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/last_child_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':last-child pseudo class' do
- example 'parse the :last-child pseudo class' do
+ describe ':last-child pseudo class' do
+ it 'parses the :last-child pseudo class' do
parse_css(':last-child').should == parse_xpath(
'descendant::*[count(following-sibling::*) = 0]'
)
diff --git a/spec/oga/css/parser/pseudo_classes/last_of_type_spec.rb b/spec/oga/css/parser/pseudo_classes/last_of_type_spec.rb
index d53c578..f38ed62 100644
--- a/spec/oga/css/parser/pseudo_classes/last_of_type_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/last_of_type_spec.rb
@@ -1,14 +1,14 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':last-of-type pseudo class' do
- example 'parse the :last-of-type pseudo class' do
+ describe ':last-of-type pseudo class' do
+ it 'parses the :last-of-type pseudo class' do
parse_css(':last-of-type').should == parse_xpath(
'descendant::*[count(following-sibling::*) = 0]'
)
end
- example 'parse the a:last-of-type pseudo class' do
+ it 'parses the a:last-of-type pseudo class' do
parse_css('a:last-of-type').should == parse_xpath(
'descendant::a[count(following-sibling::a) = 0]'
)
diff --git a/spec/oga/css/parser/pseudo_classes/nth_child_spec.rb b/spec/oga/css/parser/pseudo_classes/nth_child_spec.rb
index 12d3d5c..ce20be4 100644
--- a/spec/oga/css/parser/pseudo_classes/nth_child_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/nth_child_spec.rb
@@ -1,90 +1,90 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':nth-child pseudo class' do
- example 'parse the x:nth-child(1) pseudo class' do
+ describe ':nth-child pseudo class' do
+ it 'parses the x:nth-child(1) pseudo class' do
parse_css('x:nth-child(1)').should == parse_xpath(
'descendant::x[count(preceding-sibling::*) = 0]'
)
end
- example 'parse the :nth-child(1) pseudo class' do
+ it 'parses the :nth-child(1) pseudo class' do
parse_css(':nth-child(1)').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 0]'
)
end
- example 'parse the :nth-child(2) pseudo class' do
+ it 'parses the :nth-child(2) pseudo class' do
parse_css(':nth-child(2)').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 1]'
)
end
- example 'parse the x:nth-child(even) pseudo class' do
+ it 'parses the x:nth-child(even) pseudo class' do
parse_css('x:nth-child(even)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::*) + 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-child(odd) pseudo class' do
+ it 'parses the x:nth-child(odd) pseudo class' do
parse_css('x:nth-child(odd)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::*) + 1) >= 1 ' \
'and (((count(preceding-sibling::*) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-child(n) pseudo class' do
+ it 'parses the x:nth-child(n) pseudo class' do
parse_css('x:nth-child(n)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::*) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-child(-n) pseudo class' do
+ it 'parses the x:nth-child(-n) pseudo class' do
parse_css('x:nth-child(-n)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::*) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-child(-n+6) pseudo class' do
+ it 'parses the x:nth-child(-n+6) pseudo class' do
parse_css('x:nth-child(-n+6)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::*) + 1) <= 6) ' \
'and (((count(preceding-sibling::*) + 1) - 6) mod 1) = 0]'
)
end
- example 'parse the x:nth-child(n+5) pseudo class' do
+ it 'parses the x:nth-child(n+5) pseudo class' do
parse_css('x:nth-child(n+5)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::*) + 1) >= 5 ' \
'and (((count(preceding-sibling::*) + 1) - 5) mod 1) = 0]'
)
end
- example 'parse the x:nth-child(2n) pseudo class' do
+ it 'parses the x:nth-child(2n) pseudo class' do
parse_css('x:nth-child(2n)').should == parse_css('x:nth-child(even)')
end
- example 'parse the x:nth-child(2n+1) pseudo class' do
+ it 'parses the x:nth-child(2n+1) pseudo class' do
parse_css('x:nth-child(2n+1)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::*) + 1) >= 1 ' \
'and (((count(preceding-sibling::*) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-child(3n+1) pseudo class' do
+ it 'parses the x:nth-child(3n+1) pseudo class' do
parse_css('x:nth-child(3n+1)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::*) + 1) >= 1 ' \
'and (((count(preceding-sibling::*) + 1) - 1) mod 3) = 0]'
)
end
- example 'parse the x:nth-child(2n-6) pseudo class' do
+ it 'parses the x:nth-child(2n-6) pseudo class' do
parse_css('x:nth-child(2n-6)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::*) + 1) >= 2 ' \
'and (((count(preceding-sibling::*) + 1) - 2) mod 2) = 0]'
)
end
- example 'parse the x:nth-child(-2n+6) pseudo class' do
+ it 'parses the x:nth-child(-2n+6) pseudo class' do
parse_css('x:nth-child(-2n+6)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::*) + 1) <= 6) ' \
'and (((count(preceding-sibling::*) + 1) - 6) mod 2) = 0]'
diff --git a/spec/oga/css/parser/pseudo_classes/nth_last_child_spec.rb b/spec/oga/css/parser/pseudo_classes/nth_last_child_spec.rb
index da48895..e9aeaa6 100644
--- a/spec/oga/css/parser/pseudo_classes/nth_last_child_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/nth_last_child_spec.rb
@@ -1,85 +1,85 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':nth-last-child pseudo class' do
- example 'parse the x:nth-last-child(1) pseudo class' do
+ describe ':nth-last-child pseudo class' do
+ it 'parses the x:nth-last-child(1) pseudo class' do
parse_css('x:nth-last-child(1)').should == parse_xpath(
'descendant::x[count(following-sibling::*) = 0]'
)
end
- example 'parse the :nth-last-child(1) pseudo class' do
+ it 'parses the :nth-last-child(1) pseudo class' do
parse_css(':nth-last-child(1)').should == parse_xpath(
'descendant::*[count(following-sibling::*) = 0]'
)
end
- example 'parse the :nth-last-child(2) pseudo class' do
+ it 'parses the :nth-last-child(2) pseudo class' do
parse_css(':nth-last-child(2)').should == parse_xpath(
'descendant::*[count(following-sibling::*) = 1]'
)
end
- example 'parse the x:nth-last-child(even) pseudo class' do
+ it 'parses the x:nth-last-child(even) pseudo class' do
parse_css('x:nth-last-child(even)').should == parse_xpath(
'descendant::x[((count(following-sibling::*) + 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-child(odd) pseudo class' do
+ it 'parses the x:nth-last-child(odd) pseudo class' do
parse_css('x:nth-last-child(odd)').should == parse_xpath(
'descendant::x[(count(following-sibling::*) + 1) >= 1 ' \
'and (((count(following-sibling::*) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-child(n) pseudo class' do
+ it 'parses the x:nth-last-child(n) pseudo class' do
parse_css('x:nth-last-child(n)').should == parse_xpath(
'descendant::x[((count(following-sibling::*) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-child(-n) pseudo class' do
+ it 'parses the x:nth-last-child(-n) pseudo class' do
parse_css('x:nth-last-child(-n)').should == parse_xpath(
'descendant::x[((count(following-sibling::*) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-child(-n+6) pseudo class' do
+ it 'parses the x:nth-last-child(-n+6) pseudo class' do
parse_css('x:nth-last-child(-n+6)').should == parse_xpath(
'descendant::x[((count(following-sibling::*) + 1) <= 6) ' \
'and (((count(following-sibling::*) + 1) - 6) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-child(2n) pseudo class' do
+ it 'parses the x:nth-last-child(2n) pseudo class' do
parse_css('x:nth-last-child(2n)').should == parse_css(
'x:nth-last-child(even)'
)
end
- example 'parse the x:nth-last-child(2n+1) pseudo class' do
+ it 'parses the x:nth-last-child(2n+1) pseudo class' do
parse_css('x:nth-last-child(2n+1)').should == parse_xpath(
'descendant::x[(count(following-sibling::*) + 1) >= 1 ' \
'and (((count(following-sibling::*) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-child(2n-6) pseudo class' do
+ it 'parses the x:nth-last-child(2n-6) pseudo class' do
parse_css('x:nth-last-child(2n-6)').should == parse_xpath(
'descendant::x[(count(following-sibling::*) + 1) >= 2 ' \
'and (((count(following-sibling::*) + 1) - 2) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-child(-2n-6) pseudo class' do
+ it 'parses the x:nth-last-child(-2n-6) pseudo class' do
parse_css('x:nth-last-child(-2n-6)').should == parse_xpath(
'descendant::x[((count(following-sibling::*) + 1) <= -2) ' \
'and (((count(following-sibling::*) + 1) - -2) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-child(-2n+6) pseudo class' do
+ it 'parses the x:nth-last-child(-2n+6) pseudo class' do
parse_css('x:nth-last-child(-2n+6)').should == parse_xpath(
'descendant::x[((count(following-sibling::*) + 1) <= 6) ' \
'and (((count(following-sibling::*) + 1) - 6) mod 2) = 0]'
diff --git a/spec/oga/css/parser/pseudo_classes/nth_last_of_type_spec.rb b/spec/oga/css/parser/pseudo_classes/nth_last_of_type_spec.rb
index f2024dd..22f3d3d 100644
--- a/spec/oga/css/parser/pseudo_classes/nth_last_of_type_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/nth_last_of_type_spec.rb
@@ -1,91 +1,91 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':nth-last-of-type pseudo class' do
- example 'parse the x:nth-last-of-type(1) pseudo class' do
+ describe ':nth-last-of-type pseudo class' do
+ it 'parses the x:nth-last-of-type(1) pseudo class' do
parse_css('x:nth-last-of-type(1)').should == parse_xpath(
'descendant::x[count(following-sibling::x) = 0]'
)
end
- example 'parse the :nth-last-of-type(1) pseudo class' do
+ it 'parses the :nth-last-of-type(1) pseudo class' do
parse_css(':nth-last-of-type(1)').should == parse_xpath(
'descendant::*[count(following-sibling::*) = 0]'
)
end
- example 'parse the :nth-last-of-type(2) pseudo class' do
+ it 'parses the :nth-last-of-type(2) pseudo class' do
parse_css(':nth-last-of-type(2)').should == parse_xpath(
'descendant::*[count(following-sibling::*) = 1]'
)
end
- example 'parse the x:nth-last-of-type(even) pseudo class' do
+ it 'parses the x:nth-last-of-type(even) pseudo class' do
parse_css('x:nth-last-of-type(even)').should == parse_xpath(
'descendant::x[((count(following-sibling::x) + 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-of-type(odd) pseudo class' do
+ it 'parses the x:nth-last-of-type(odd) pseudo class' do
parse_css('x:nth-last-of-type(odd)').should == parse_xpath(
'descendant::x[(count(following-sibling::x) + 1) >= 1 ' \
'and (((count(following-sibling::x) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-of-type(n) pseudo class' do
+ it 'parses the x:nth-last-of-type(n) pseudo class' do
parse_css('x:nth-last-of-type(n)').should == parse_xpath(
'descendant::x[((count(following-sibling::x) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-of-type(-n) pseudo class' do
+ it 'parses the x:nth-last-of-type(-n) pseudo class' do
parse_css('x:nth-last-of-type(-n)').should == parse_xpath(
'descendant::x[((count(following-sibling::x) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-of-type(-n+6) pseudo class' do
+ it 'parses the x:nth-last-of-type(-n+6) pseudo class' do
parse_css('x:nth-last-of-type(-n+6)').should == parse_xpath(
'descendant::x[((count(following-sibling::x) + 1) <= 6) ' \
'and (((count(following-sibling::x) + 1) - 6) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-of-type(n+5) pseudo class' do
+ it 'parses the x:nth-last-of-type(n+5) pseudo class' do
parse_css('x:nth-last-of-type(n+5)').should == parse_xpath(
'descendant::x[(count(following-sibling::x) + 1) >= 5 ' \
'and (((count(following-sibling::x) + 1) - 5) mod 1) = 0]'
)
end
- example 'parse the x:nth-last-of-type(2n) pseudo class' do
+ it 'parses the x:nth-last-of-type(2n) pseudo class' do
parse_css('x:nth-last-of-type(2n)')
.should == parse_css('x:nth-last-of-type(even)')
end
- example 'parse the x:nth-last-of-type(2n+1) pseudo class' do
+ it 'parses the x:nth-last-of-type(2n+1) pseudo class' do
parse_css('x:nth-last-of-type(2n+1)').should == parse_xpath(
'descendant::x[(count(following-sibling::x) + 1) >= 1 ' \
'and (((count(following-sibling::x) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-of-type(3n+1) pseudo class' do
+ it 'parses the x:nth-last-of-type(3n+1) pseudo class' do
parse_css('x:nth-last-of-type(3n+1)').should == parse_xpath(
'descendant::x[(count(following-sibling::x) + 1) >= 1 ' \
'and (((count(following-sibling::x) + 1) - 1) mod 3) = 0]'
)
end
- example 'parse the x:nth-last-of-type(2n-6) pseudo class' do
+ it 'parses the x:nth-last-of-type(2n-6) pseudo class' do
parse_css('x:nth-last-of-type(2n-6)').should == parse_xpath(
'descendant::x[(count(following-sibling::x) + 1) >= 2 ' \
'and (((count(following-sibling::x) + 1) - 2) mod 2) = 0]'
)
end
- example 'parse the x:nth-last-of-type(-2n+6) pseudo class' do
+ it 'parses the x:nth-last-of-type(-2n+6) pseudo class' do
parse_css('x:nth-last-of-type(-2n+6)').should == parse_xpath(
'descendant::x[((count(following-sibling::x) + 1) <= 6) ' \
'and (((count(following-sibling::x) + 1) - 6) mod 2) = 0]'
diff --git a/spec/oga/css/parser/pseudo_classes/nth_of_type_spec.rb b/spec/oga/css/parser/pseudo_classes/nth_of_type_spec.rb
index d816c80..7443be8 100644
--- a/spec/oga/css/parser/pseudo_classes/nth_of_type_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/nth_of_type_spec.rb
@@ -1,90 +1,90 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':nth-of-type pseudo class' do
- example 'parse the x:nth-of-type(1) pseudo class' do
+ describe ':nth-of-type pseudo class' do
+ it 'parses the x:nth-of-type(1) pseudo class' do
parse_css('x:nth-of-type(1)').should == parse_xpath(
'descendant::x[count(preceding-sibling::x) = 0]'
)
end
- example 'parse the :nth-of-type(1) pseudo class' do
+ it 'parses the :nth-of-type(1) pseudo class' do
parse_css(':nth-of-type(1)').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 0]'
)
end
- example 'parse the :nth-of-type(2) pseudo class' do
+ it 'parses the :nth-of-type(2) pseudo class' do
parse_css(':nth-of-type(2)').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 1]'
)
end
- example 'parse the x:nth-of-type(even) pseudo class' do
+ it 'parses the x:nth-of-type(even) pseudo class' do
parse_css('x:nth-of-type(even)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::x) + 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-of-type(odd) pseudo class' do
+ it 'parses the x:nth-of-type(odd) pseudo class' do
parse_css('x:nth-of-type(odd)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::x) + 1) >= 1 ' \
'and (((count(preceding-sibling::x) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-of-type(n) pseudo class' do
+ it 'parses the x:nth-of-type(n) pseudo class' do
parse_css('x:nth-of-type(n)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::x) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-of-type(-n) pseudo class' do
+ it 'parses the x:nth-of-type(-n) pseudo class' do
parse_css('x:nth-of-type(-n)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::x) + 1) mod 1) = 0]'
)
end
- example 'parse the x:nth-of-type(-n+6) pseudo class' do
+ it 'parses the x:nth-of-type(-n+6) pseudo class' do
parse_css('x:nth-of-type(-n+6)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::x) + 1) <= 6) ' \
'and (((count(preceding-sibling::x) + 1) - 6) mod 1) = 0]'
)
end
- example 'parse the x:nth-of-type(n+5) pseudo class' do
+ it 'parses the x:nth-of-type(n+5) pseudo class' do
parse_css('x:nth-of-type(n+5)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::x) + 1) >= 5 ' \
'and (((count(preceding-sibling::x) + 1) - 5) mod 1) = 0]'
)
end
- example 'parse the x:nth-of-type(2n) pseudo class' do
+ it 'parses the x:nth-of-type(2n) pseudo class' do
parse_css('x:nth-of-type(2n)').should == parse_css('x:nth-of-type(even)')
end
- example 'parse the x:nth-of-type(2n+1) pseudo class' do
+ it 'parses the x:nth-of-type(2n+1) pseudo class' do
parse_css('x:nth-of-type(2n+1)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::x) + 1) >= 1 ' \
'and (((count(preceding-sibling::x) + 1) - 1) mod 2) = 0]'
)
end
- example 'parse the x:nth-of-type(3n+1) pseudo class' do
+ it 'parses the x:nth-of-type(3n+1) pseudo class' do
parse_css('x:nth-of-type(3n+1)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::x) + 1) >= 1 ' \
'and (((count(preceding-sibling::x) + 1) - 1) mod 3) = 0]'
)
end
- example 'parse the x:nth-of-type(2n-6) pseudo class' do
+ it 'parses the x:nth-of-type(2n-6) pseudo class' do
parse_css('x:nth-of-type(2n-6)').should == parse_xpath(
'descendant::x[(count(preceding-sibling::x) + 1) >= 2 ' \
'and (((count(preceding-sibling::x) + 1) - 2) mod 2) = 0]'
)
end
- example 'parse the x:nth-of-type(-2n+6) pseudo class' do
+ it 'parses the x:nth-of-type(-2n+6) pseudo class' do
parse_css('x:nth-of-type(-2n+6)').should == parse_xpath(
'descendant::x[((count(preceding-sibling::x) + 1) <= 6) ' \
'and (((count(preceding-sibling::x) + 1) - 6) mod 2) = 0]'
diff --git a/spec/oga/css/parser/pseudo_classes/only_child_spec.rb b/spec/oga/css/parser/pseudo_classes/only_child_spec.rb
index e095233..086629f 100644
--- a/spec/oga/css/parser/pseudo_classes/only_child_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/only_child_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':only-child pseudo class' do
- example 'parse the :only-child pseudo class' do
+ describe ':only-child pseudo class' do
+ it 'parses the :only-child pseudo class' do
parse_css(':only-child').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 0 ' \
'and count(following-sibling::*) = 0]'
diff --git a/spec/oga/css/parser/pseudo_classes/only_of_type_spec.rb b/spec/oga/css/parser/pseudo_classes/only_of_type_spec.rb
index 8a4c89c..b2384ff 100644
--- a/spec/oga/css/parser/pseudo_classes/only_of_type_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/only_of_type_spec.rb
@@ -1,15 +1,15 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':only-of-type pseudo class' do
- example 'parse the :only-of-type pseudo class' do
+ describe ':only-of-type pseudo class' do
+ it 'parses the :only-of-type pseudo class' do
parse_css(':only-of-type').should == parse_xpath(
'descendant::*[count(preceding-sibling::*) = 0 and ' \
'count(following-sibling::*) = 0]'
)
end
- example 'parse the a:only-of-type pseudo class' do
+ it 'parses the a:only-of-type pseudo class' do
parse_css('a:only-of-type').should == parse_xpath(
'descendant::a[count(preceding-sibling::a) = 0 and ' \
'count(following-sibling::a) = 0]'
diff --git a/spec/oga/css/parser/pseudo_classes/root_spec.rb b/spec/oga/css/parser/pseudo_classes/root_spec.rb
index 4e1db6a..fb56800 100644
--- a/spec/oga/css/parser/pseudo_classes/root_spec.rb
+++ b/spec/oga/css/parser/pseudo_classes/root_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context ':root pseudo class' do
- example 'parse the x:root pseudo class' do
+ describe ':root pseudo class' do
+ it 'parses the x:root pseudo class' do
parse_css('x:root').should == parse_xpath('descendant::x[not(parent::*)]')
end
- example 'parse the :root pseudo class' do
+ it 'parses the :root pseudo class' do
parse_css(':root').should == parse_xpath('descendant::*[not(parent::*)]')
end
end
diff --git a/spec/oga/css/parser/wildcards_spec.rb b/spec/oga/css/parser/wildcards_spec.rb
index 9a4c734..2f0238b 100644
--- a/spec/oga/css/parser/wildcards_spec.rb
+++ b/spec/oga/css/parser/wildcards_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::CSS::Parser do
- context 'wildcards' do
- example 'parse a wildcard name test' do
+ describe 'wildcards' do
+ it 'parses a wildcard name test' do
parse_css('*').should == parse_xpath('descendant::*')
end
- example 'parse a wildcard namespace test' do
+ it 'parses a wildcard namespace test' do
parse_css('*|foo').should == parse_xpath('descendant::*:foo')
end
- example 'parse a wildcard namespace and name test' do
+ it 'parses a wildcard namespace and name test' do
parse_css('*|*').should == parse_xpath('descendant::*:*')
end
end
diff --git a/spec/oga/html/parser/element_spec.rb b/spec/oga/html/parser/element_spec.rb
index 6db3111..ba077f4 100644
--- a/spec/oga/html/parser/element_spec.rb
+++ b/spec/oga/html/parser/element_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::HTML::Parser do
- context 'HTML void elements' do
+ describe 'HTML void elements' do
before :all do
@node = parse_html('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@node.is_a?(Oga::XML::Element).should == true
end
- example 'set the name of the element' do
+ it 'sets the name of the element' do
@node.name.should == 'meta'
end
end
diff --git a/spec/oga/html/sax_parser_spec.rb b/spec/oga/html/sax_parser_spec.rb
index c4c775c..2552e97 100644
--- a/spec/oga/html/sax_parser_spec.rb
+++ b/spec/oga/html/sax_parser_spec.rb
@@ -11,7 +11,7 @@ describe Oga::HTML::SaxParser do
end
end
- example 'use custom callback methods if defined' do
+ it 'uses custom callback methods if defined' do
handler = @handler.new
parser = described_class.new(handler, '')
diff --git a/spec/oga/oga_spec.rb b/spec/oga/oga_spec.rb
index 569a788..48e98ac 100644
--- a/spec/oga/oga_spec.rb
+++ b/spec/oga/oga_spec.rb
@@ -1,19 +1,19 @@
require 'spec_helper'
describe Oga do
- example 'parse an XML document' do
+ it 'parses an XML document' do
document = described_class.parse_xml('foo')
document.is_a?(Oga::XML::Document).should == true
end
- example 'parse an HTML document' do
+ it 'parses an HTML document' do
document = described_class.parse_xml('')
document.is_a?(Oga::XML::Document).should == true
end
- context 'SAX parsing' do
+ describe 'SAX parsing' do
before do
klass = Class.new do
attr_reader :name
@@ -26,13 +26,13 @@ describe Oga do
@handler = klass.new
end
- example 'parse an XML document using the SAX parser' do
+ it 'parses an XML document using the SAX parser' do
Oga.sax_parse_xml(@handler, '')
@handler.name.should == 'foo'
end
- example 'parse an HTML document using the SAX parser' do
+ it 'parses an HTML document using the SAX parser' do
Oga.sax_parse_xml(@handler, '')
@handler.name.should == 'link'
diff --git a/spec/oga/xml/attribute_spec.rb b/spec/oga/xml/attribute_spec.rb
index f15de0b..686e1bf 100644
--- a/spec/oga/xml/attribute_spec.rb
+++ b/spec/oga/xml/attribute_spec.rb
@@ -1,17 +1,17 @@
require 'spec_helper'
describe Oga::XML::Attribute do
- context '#initialize' do
- example 'set the name' do
+ describe '#initialize' do
+ it 'sets the name' do
described_class.new(:name => 'a').name.should == 'a'
end
- example 'set the value' do
+ it 'sets the value' do
described_class.new(:value => 'a').value.should == 'a'
end
end
- context '#namespace' do
+ describe '#namespace' do
before do
@namespace = Oga::XML::Namespace.new(:name => 'b')
@@ -28,33 +28,33 @@ describe Oga::XML::Attribute do
@default = described_class.new(:namespace_name => 'xml', :name => 'x')
end
- example 'return a Namespace instance' do
+ it 'returns a Namespace instance' do
@attribute.namespace.should == @namespace
end
- example 'return the default XML namespace when the "xml" prefix is used' do
+ it 'returns the default XML namespace when the "xml" prefix is used' do
@default.namespace.should == Oga::XML::Attribute::DEFAULT_NAMESPACE
end
end
- context '#text' do
- example 'return an empty String when there is no value' do
+ describe '#text' do
+ it 'returns an empty String when there is no value' do
described_class.new.text.should == ''
end
- example 'return the value if it is present' do
+ it 'returns the value if it is present' do
described_class.new(:value => 'a').text.should == 'a'
end
end
- context '#to_xml' do
- example 'convert an attribute to XML' do
+ describe '#to_xml' do
+ it 'converts an attribute to XML' do
attr = described_class.new(:name => 'foo', :value => 'bar')
attr.to_xml.should == 'foo="bar"'
end
- example 'include the namespace when converting an attribute to XML' do
+ it 'includes the namespace when converting an attribute to XML' do
element = Oga::XML::Element.new
element.register_namespace('foo', 'http://foo')
@@ -69,7 +69,7 @@ describe Oga::XML::Attribute do
attr.to_xml.should == 'foo:class="10"'
end
- example 'include the "xmlns" namespace when present but not registered' do
+ it 'includes the "xmlns" namespace when present but not registered' do
attr = described_class.new(
:name => 'class',
:namespace_name => 'xmlns',
@@ -79,15 +79,15 @@ describe Oga::XML::Attribute do
attr.to_xml.should == 'xmlns:class=""'
end
- example 'convert special characters to XML entities' do
+ it 'converts special characters to XML entities' do
attr = described_class.new(:name => 'href', :value => '&<>')
attr.to_xml.should == 'href="&<>"'
end
end
- context '#inspect' do
- example 'return the inspect value' do
+ describe '#inspect' do
+ it 'returns the inspect value' do
element = Oga::XML::Element.new(
:namespaces => {'b' => Oga::XML::Namespace.new(:name => 'b')}
)
diff --git a/spec/oga/xml/cdata_spec.rb b/spec/oga/xml/cdata_spec.rb
index 3d54cd7..06ad695 100644
--- a/spec/oga/xml/cdata_spec.rb
+++ b/spec/oga/xml/cdata_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::Cdata do
- context 'setting attributes' do
- example 'set the text via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the text via the constructor' do
described_class.new(:text => 'foo').text.should == 'foo'
end
- example 'set the text via a setter' do
+ it 'sets the text via a setter' do
instance = described_class.new
instance.text = 'foo'
@@ -14,22 +14,22 @@ describe Oga::XML::Cdata do
end
end
- context '#to_xml' do
+ describe '#to_xml' do
before do
@instance = described_class.new(:text => 'foo')
end
- example 'generate the corresponding XML' do
+ it 'generates the corresponding XML' do
@instance.to_xml.should == ''
end
end
- context '#inspect' do
+ describe '#inspect' do
before do
@instance = described_class.new(:text => 'foo')
end
- example 'return the inspect value' do
+ it 'returns the inspect value' do
@instance.inspect.should == 'Cdata("foo")'
end
end
diff --git a/spec/oga/xml/character_node_spec.rb b/spec/oga/xml/character_node_spec.rb
index 05ffe7b..e21c681 100644
--- a/spec/oga/xml/character_node_spec.rb
+++ b/spec/oga/xml/character_node_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::CharacterNode do
- context '#initialize' do
- example 'set the text in the constructor' do
+ describe '#initialize' do
+ it 'sets the text in the constructor' do
described_class.new(:text => 'a').text.should == 'a'
end
- example 'set the text via an attribute' do
+ it 'sets the text via an attribute' do
node = described_class.new
node.text = 'a'
@@ -14,14 +14,14 @@ describe Oga::XML::CharacterNode do
end
end
- context '#to_xml' do
- example 'convert the node to XML' do
+ describe '#to_xml' do
+ it 'converts the node to XML' do
described_class.new(:text => 'a').to_xml.should == 'a'
end
end
- context '#inspect' do
- example 'return the inspect value' do
+ describe '#inspect' do
+ it 'returns the inspect value' do
described_class.new(:text => 'a').inspect.should == 'CharacterNode("a")'
end
end
diff --git a/spec/oga/xml/comment_spec.rb b/spec/oga/xml/comment_spec.rb
index 8a2418a..e523c38 100644
--- a/spec/oga/xml/comment_spec.rb
+++ b/spec/oga/xml/comment_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::Comment do
- context 'setting attributes' do
- example 'set the text via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the text via the constructor' do
described_class.new(:text => 'foo').text.should == 'foo'
end
- example 'set the text via a setter' do
+ it 'sets the text via a setter' do
instance = described_class.new
instance.text = 'foo'
@@ -14,22 +14,22 @@ describe Oga::XML::Comment do
end
end
- context '#to_xml' do
+ describe '#to_xml' do
before do
@instance = described_class.new(:text => 'foo')
end
- example 'generate the corresponding XML' do
+ it 'generates the corresponding XML' do
@instance.to_xml.should == ''
end
end
- context '#inspect' do
+ describe '#inspect' do
before do
@instance = described_class.new(:text => 'foo')
end
- example 'return the inspect value' do
+ it 'returns the inspect value' do
@instance.inspect.should == 'Comment("foo")'
end
end
diff --git a/spec/oga/xml/doctype_spec.rb b/spec/oga/xml/doctype_spec.rb
index a316335..639f39a 100644
--- a/spec/oga/xml/doctype_spec.rb
+++ b/spec/oga/xml/doctype_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::Doctype do
- context 'setting attributes' do
- example 'set the name via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the name via the constructor' do
described_class.new(:name => 'html').name.should == 'html'
end
- example 'set the name via a setter' do
+ it 'sets the name via a setter' do
instance = described_class.new
instance.name = 'html'
@@ -14,18 +14,18 @@ describe Oga::XML::Doctype do
end
end
- context '#to_xml' do
- example 'generate a bare minimum representation' do
+ describe '#to_xml' do
+ it 'generates a bare minimum representation' do
described_class.new(:name => 'html').to_xml.should == ''
end
- example 'include the type if present' do
+ it 'includes the type if present' do
instance = described_class.new(:name => 'html', :type => 'PUBLIC')
instance.to_xml.should == ''
end
- example 'include the public ID if present' do
+ it 'includes the public ID if present' do
instance = described_class.new(
:name => 'html',
:type => 'PUBLIC',
@@ -35,7 +35,7 @@ describe Oga::XML::Doctype do
instance.to_xml.should == ''
end
- example 'include the system ID if present' do
+ it 'includes the system ID if present' do
instance = described_class.new(
:name => 'html',
:type => 'PUBLIC',
@@ -46,7 +46,7 @@ describe Oga::XML::Doctype do
instance.to_xml.should == ''
end
- example 'include the inline rules if present' do
+ it 'includes the inline rules if present' do
instance = described_class.new(
:name => 'html',
:inline_rules => ''
@@ -56,7 +56,7 @@ describe Oga::XML::Doctype do
end
end
- context '#inspect' do
+ describe '#inspect' do
before do
@instance = described_class.new(
:name => 'html',
@@ -65,7 +65,7 @@ describe Oga::XML::Doctype do
)
end
- example 'pretty-print the node' do
+ it 'pretty-prints the node' do
@instance.inspect.should == <<-EOF.strip
Doctype(name: "html" type: "PUBLIC" inline_rules: "")
EOF
diff --git a/spec/oga/xml/document_spec.rb b/spec/oga/xml/document_spec.rb
index 4f33f32..bec8865 100644
--- a/spec/oga/xml/document_spec.rb
+++ b/spec/oga/xml/document_spec.rb
@@ -1,21 +1,21 @@
require 'spec_helper'
describe Oga::XML::Document do
- context 'setting attributes' do
- example 'set the child nodes via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the child nodes via the constructor' do
child = Oga::XML::Comment.new(:text => 'foo')
document = described_class.new(:children => [child])
document.children[0].should == child
end
- example 'set the document type' do
+ it 'sets the document type' do
described_class.new(:type => :html).type.should == :html
end
end
- context '#children=' do
- example 'set the child nodes using an Array' do
+ describe '#children=' do
+ it 'sets the child nodes using an Array' do
child = Oga::XML::Comment.new(:text => 'foo')
document = described_class.new
@@ -24,7 +24,7 @@ describe Oga::XML::Document do
document.children[0].should == child
end
- example 'set the child nodes using a NodeSet' do
+ it 'sets the child nodes using a NodeSet' do
child = Oga::XML::Comment.new(:text => 'foo')
document = described_class.new
@@ -34,18 +34,18 @@ describe Oga::XML::Document do
end
end
- context '#to_xml' do
+ describe '#to_xml' do
before do
child = Oga::XML::Comment.new(:text => 'foo')
@document = described_class.new(:children => [child])
end
- example 'generate the corresponding XML' do
+ it 'generates the corresponding XML' do
@document.to_xml.should == ''
end
end
- context '#to_xml with XML declarations' do
+ describe '#to_xml with XML declarations' do
before do
decl = Oga::XML::XmlDeclaration.new(:version => '5.0')
children = [Oga::XML::Comment.new(:text => 'foo')]
@@ -56,13 +56,13 @@ describe Oga::XML::Document do
)
end
- example 'include the XML of the declaration tag' do
+ it 'includes the XML of the declaration tag' do
@document.to_xml
.should == %Q{\n}
end
end
- context '#to_xml with doctypes' do
+ describe '#to_xml with doctypes' do
before do
doctype = Oga::XML::Doctype.new(:name => 'html', :type => 'PUBLIC')
children = [Oga::XML::Comment.new(:text => 'foo')]
@@ -73,12 +73,12 @@ describe Oga::XML::Document do
)
end
- example 'include the doctype' do
+ it 'includes the doctype' do
@document.to_xml.should == %Q{\n}
end
end
- context '#to_xml with XML declarations and doctypes' do
+ describe '#to_xml with XML declarations and doctypes' do
before do
decl = Oga::XML::XmlDeclaration.new(:version => '5.0')
doctype = Oga::XML::Doctype.new(:name => 'html', :type => 'PUBLIC')
@@ -91,13 +91,13 @@ describe Oga::XML::Document do
)
end
- example 'include the doctype and XML declaration' do
+ it 'includes the doctype and XML declaration' do
@document.to_xml.should == '' \
"\n\n"
end
end
- context '#inspect' do
+ describe '#inspect' do
before do
@instance = described_class.new(
:doctype => Oga::XML::Doctype.new(:name => 'html'),
@@ -106,7 +106,7 @@ describe Oga::XML::Document do
)
end
- example 'return the inspect value' do
+ it 'returns the inspect value' do
@instance.inspect.should == <<-EOF.strip
Document(
doctype: Doctype(name: "html")
@@ -116,7 +116,7 @@ Document(
EOF
end
- example 'return the inspect value of an empty document' do
+ it 'returns the inspect value of an empty document' do
described_class.new.inspect.should == <<-EOF.strip
Document(
children: NodeSet()
diff --git a/spec/oga/xml/element_spec.rb b/spec/oga/xml/element_spec.rb
index 26664e4..67b4223 100644
--- a/spec/oga/xml/element_spec.rb
+++ b/spec/oga/xml/element_spec.rb
@@ -1,52 +1,52 @@
require 'spec_helper'
describe Oga::XML::Element do
- context 'setting attributes' do
- example 'set the name via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the name via the constructor' do
described_class.new(:name => 'p').name.should == 'p'
end
- example 'set the name via a setter' do
+ it 'sets the name via a setter' do
instance = described_class.new
instance.name = 'p'
instance.name.should == 'p'
end
- example 'set the default attributes' do
+ it 'sets the default attributes' do
described_class.new.attributes.should == []
end
end
- context 'setting namespaces via attributes' do
+ describe 'setting namespaces via attributes' do
before do
attr = Oga::XML::Attribute.new(:name => 'foo', :namespace_name => 'xmlns')
@element = described_class.new(:attributes => [attr])
end
- example 'register the "foo" namespace' do
+ it 'registers the "foo" namespace' do
@element.namespaces['foo'].is_a?(Oga::XML::Namespace).should == true
end
- example 'keep the attributes after registering the namespaces' do
+ it 'keeps the attributes after registering the namespaces' do
@element.attributes.empty?.should == false
end
end
- context 'setting the default namespace without a prefix' do
+ describe 'setting the default namespace without a prefix' do
before do
attr = Oga::XML::Attribute.new(:name => 'xmlns', :value => 'foo')
@element = described_class.new(:attributes => [attr])
end
- example 'register the default namespace' do
+ it 'registers the default namespace' do
@element.namespaces['xmlns'].is_a?(Oga::XML::Namespace).should == true
end
end
- context '#attribute' do
+ describe '#attribute' do
before do
attributes = [
Oga::XML::Attribute.new(:name => 'key', :value => 'value'),
@@ -68,90 +68,90 @@ describe Oga::XML::Element do
)
end
- example 'return an attribute with only a name' do
+ it 'returns an attribute with only a name' do
@instance.attribute('key').value.should == 'value'
end
- example 'return an attribute with only a name when using a Symbol' do
+ it 'returns an attribute with only a name when using a Symbol' do
@instance.attribute(:key).value.should == 'value'
end
- example 'return an attribute with a name and namespace' do
+ it 'returns an attribute with a name and namespace' do
@instance.attribute('x:key').value.should == 'foo'
end
- example 'return an attribute with a name and namespace when using a Symbol' do
+ it 'returns an attribute with a name and namespace when using a Symbol' do
@instance.attribute(:'x:key').value.should == 'foo'
end
- example 'return nil when the name matches but the namespace does not' do
+ it 'returns nil when the name matches but the namespace does not' do
@instance.attribute('y:key').nil?.should == true
end
- example 'return nil when the namespace matches but the name does not' do
+ it 'returns nil when the namespace matches but the name does not' do
@instance.attribute('x:foobar').nil?.should == true
end
- example 'return nil for a non existing attribute' do
+ it 'returns nil for a non existing attribute' do
@instance.attribute('foobar').nil?.should == true
end
- example 'return nil if an attribute has a namespace that is not given' do
+ it 'returns nil if an attribute has a namespace that is not given' do
@instance.attribute('bar').nil?.should == true
end
end
- context '#get' do
+ describe '#get' do
before do
attr = Oga::XML::Attribute.new(:name => 'foo', :value => 'bar')
@element = described_class.new(:attributes => [attr])
end
- example 'return the value of an attribute' do
+ it 'returns the value of an attribute' do
@element.get('foo').should == 'bar'
end
end
- context '#add_attribute' do
+ describe '#add_attribute' do
before do
@element = described_class.new
@attribute = Oga::XML::Attribute.new(:name => 'foo', :value => 'bar')
end
- example 'add an Attribute to the element' do
+ it 'adds an Attribute to the element' do
@element.add_attribute(@attribute)
@element.attribute('foo').should == @attribute
end
- example 'set the element of the attribute when adding it' do
+ it 'sets the element of the attribute when adding it' do
@element.add_attribute(@attribute)
@attribute.element.should == @element
end
end
- context '#set' do
+ describe '#set' do
before do
@element = described_class.new
@element.register_namespace('x', 'test')
end
- example 'add a new attribute' do
+ it 'adds a new attribute' do
@element.set('class', 'foo')
@element.get('class').should == 'foo'
end
- example 'add a new attribute with a namespace' do
+ it 'adds a new attribute with a namespace' do
@element.set('x:bar', 'foo')
@element.get('x:bar').should == 'foo'
end
- example 'set the namespace of an attribute' do
+ it 'sets the namespace of an attribute' do
@element.set('x:bar', 'foo')
attr = @element.attribute('x:bar')
@@ -159,7 +159,7 @@ describe Oga::XML::Element do
attr.namespace.is_a?(Oga::XML::Namespace).should == true
end
- example 'overwrite the value of an existing attribute' do
+ it 'overwrites the value of an existing attribute' do
attr = Oga::XML::Attribute.new(:name => 'foo', :value => 'bar')
@element.add_attribute(attr)
@@ -170,7 +170,7 @@ describe Oga::XML::Element do
end
end
- context '#unset' do
+ describe '#unset' do
before do
@element = described_class.new
@@ -180,21 +180,21 @@ describe Oga::XML::Element do
@element.set('x:foo', 'bar')
end
- example 'remove an attribute by its name' do
+ it 'removes an attribute by its name' do
@element.unset('foo')
@element.get('foo').should be_nil
end
- example 'remove an attribute using a namespace' do
+ it 'removes an attribute using a namespace' do
@element.unset('x:foo')
@element.get('x:foo').should be_nil
end
end
- context '#namespace' do
- example 'return the namespace' do
+ describe '#namespace' do
+ it 'returns the namespace' do
namespace = Oga::XML::Namespace.new(:name => 'x')
element = described_class.new(
:namespace_name => 'x',
@@ -204,7 +204,7 @@ describe Oga::XML::Element do
element.namespace.should == namespace
end
- example 'return the default namespace if available' do
+ it 'returns the default namespace if available' do
namespace = Oga::XML::Namespace.new(:name => 'xmlns')
element = described_class.new(
:namespaces => {'xmlns' => namespace}
@@ -214,7 +214,7 @@ describe Oga::XML::Element do
end
end
- context '#text' do
+ describe '#text' do
before do
t1 = Oga::XML::Text.new(:text => 'Foo')
t2 = Oga::XML::Text.new(:text => 'Bar')
@@ -223,16 +223,16 @@ describe Oga::XML::Element do
@n2 = described_class.new(:children => [@n1, t2])
end
- example 'return the text of the parent node and its child nodes' do
+ it 'returns the text of the parent node and its child nodes' do
@n2.text.should == 'FooBar'
end
- example 'return the text of the child node' do
+ it 'returns the text of the child node' do
@n1.text.should == 'Foo'
end
end
- context '#inner_text' do
+ describe '#inner_text' do
before do
t1 = Oga::XML::Text.new(:text => 'Foo')
t2 = Oga::XML::Text.new(:text => 'Bar')
@@ -241,26 +241,26 @@ describe Oga::XML::Element do
@n2 = described_class.new(:children => [@n1, t2])
end
- example 'return the inner text of the parent node' do
+ it 'returns the inner text of the parent node' do
@n2.inner_text.should == 'Bar'
end
- example 'return the inner text of the child node' do
+ it 'returns the inner text of the child node' do
@n1.inner_text.should == 'Foo'
end
end
- context '#inner_text=' do
+ describe '#inner_text=' do
before do
@element = described_class.new
end
- example 'set the inner text of an element' do
+ it 'sets the inner text of an element' do
@element.inner_text = 'foo'
@element.inner_text.should == 'foo'
end
- example 'remove all existing nodes before inserting a new text node' do
+ it 'removes all existing nodes before inserting a new text node' do
@element.children << Oga::XML::Text.new(:text => 'foo')
@element.children << Oga::XML::Element.new(:name => 'x')
@@ -270,7 +270,7 @@ describe Oga::XML::Element do
end
end
- context '#text_nodes' do
+ describe '#text_nodes' do
before do
@t1 = Oga::XML::Text.new(:text => 'Foo')
@t2 = Oga::XML::Text.new(:text => 'Bar')
@@ -278,17 +278,17 @@ describe Oga::XML::Element do
@element = described_class.new(:children => [@t1, @t2])
end
- example 'return a node set containing the text nodes' do
+ it 'returns a node set containing the text nodes' do
@element.text_nodes.should == node_set(@t1, @t2)
end
end
- context '#to_xml' do
- example 'generate the corresponding XML' do
+ describe '#to_xml' do
+ it 'generates the corresponding XML' do
described_class.new(:name => 'p').to_xml.should == ''
end
- example 'include the namespace if present' do
+ it 'includes the namespace if present' do
instance = described_class.new(
:name => 'p',
:namespace_name => 'foo',
@@ -299,7 +299,7 @@ describe Oga::XML::Element do
instance.to_xml.should == 'Foo'
end
- example 'include a single attribute if present' do
+ it 'includes a single attribute if present' do
instance = described_class.new(
:name => 'p',
:attributes => [
@@ -310,7 +310,7 @@ describe Oga::XML::Element do
instance.to_xml.should == ''
end
- example 'include multiple attributes if present' do
+ it 'includes multiple attributes if present' do
instance = described_class.new(
:name => 'p',
:attributes => [
@@ -322,7 +322,7 @@ describe Oga::XML::Element do
instance.to_xml.should == ''
end
- example 'include the child nodes if present' do
+ it 'includes the child nodes if present' do
instance = described_class.new(
:name => 'p',
:children => [Oga::XML::Comment.new(:text => 'foo')]
@@ -331,7 +331,7 @@ describe Oga::XML::Element do
instance.to_xml.should == ''
end
- example 'generate the corresponding XML when using a default namespace' do
+ it 'generates the corresponding XML when using a default namespace' do
namespace = Oga::XML::Namespace.new(:name => 'xmlns', :uri => 'foo')
instance = described_class.new(
:name => 'foo',
@@ -341,14 +341,14 @@ describe Oga::XML::Element do
instance.to_xml.should == ''
end
- example 'generate the XML for the HTML '
end
- example 'generate the XML for the HTML element' do
+ it 'generates the XML for the HTML element' do
element = described_class.new(:name => 'link')
document = Oga::XML::Document.new(:type => :html, :children => [element])
@@ -356,14 +356,14 @@ describe Oga::XML::Element do
end
end
- context '#inspect' do
- example 'inspect a node with a name' do
+ describe '#inspect' do
+ it 'inspects a node with a name' do
node = described_class.new(:name => 'a')
node.inspect.should == 'Element(name: "a")'
end
- example 'inspect a node with attributes and children' do
+ it 'inspects a node with attributes and children' do
node = described_class.new(
:name => 'p',
:children => [Oga::XML::Comment.new(:text => 'foo')],
@@ -374,7 +374,7 @@ describe Oga::XML::Element do
'[Attribute(name: "x" value: "y")] children: NodeSet(Comment("foo")))'
end
- example 'inspect a node with a namespace' do
+ it 'inspects a node with a namespace' do
node = described_class.new(
:name => 'p',
:namespace_name => 'x',
@@ -386,33 +386,33 @@ describe Oga::XML::Element do
end
end
- context '#register_namespace' do
+ describe '#register_namespace' do
before do
@element = described_class.new
@element.register_namespace('foo', 'http://example.com')
end
- example 'return a Namespace instance' do
+ it 'returns a Namespace instance' do
@element.namespaces['foo'].is_a?(Oga::XML::Namespace).should == true
end
- example 'set the name of the namespace' do
+ it 'sets the name of the namespace' do
@element.namespaces['foo'].name.should == 'foo'
end
- example 'set the URI of the namespace' do
+ it 'sets the URI of the namespace' do
@element.namespaces['foo'].uri.should == 'http://example.com'
end
- example 'raise ArgumentError if the namespace already exists' do
+ it 'raises ArgumentError if the namespace already exists' do
block = lambda { @element.register_namespace('foo', 'bar') }
block.should raise_error(ArgumentError)
end
end
- context '#available_namespaces' do
+ describe '#available_namespaces' do
before do
@parent = described_class.new
@child = described_class.new
@@ -428,47 +428,47 @@ describe Oga::XML::Element do
@child_ns = @child.available_namespaces
end
- example 'inherit the "foo" namespace from the parent' do
+ it 'inherits the "foo" namespace from the parent' do
@child_ns['foo'].uri.should == 'bar'
end
- example 'overwrite the "baz" namespace in the child' do
+ it 'overwrites the "baz" namespace in the child' do
@child_ns['baz'].uri.should == 'xxx'
end
- example 'return the "foo" namespace for the parent' do
+ it 'returns the "foo" namespace for the parent' do
@parent_ns['foo'].uri.should == 'bar'
end
- example 'return the "baz" namespace for the parent' do
+ it 'returns the "baz" namespace for the parent' do
@parent_ns['baz'].uri.should == 'yyy'
end
- example 'do not modify the list of direct namespaces' do
+ it 'does not modify the list of direct namespaces' do
@child.namespaces.key?('foo').should == false
end
end
- context '#self_closing?' do
- example 'return true for an empty XML element' do
+ describe '#self_closing?' do
+ it 'returns true for an empty XML element' do
described_class.new(:name => 'foo').should be_self_closing
end
- example 'return false for a non empty XML element' do
+ it 'returns false for a non empty XML element' do
text = Oga::XML::Text.new(:text => 'bar')
node = described_class.new(:name => 'foo', :children => [text])
node.should_not be_self_closing
end
- example 'return true for an HTML void element' do
+ it 'returns true for an HTML void element' do
element = described_class.new(:name => 'link')
document = Oga::XML::Document.new(:type => :html, :children => [element])
element.should be_self_closing
end
- example 'return false for a non empty HTML element' do
+ it 'returns false for a non empty HTML element' do
text = Oga::XML::Text.new(:text => 'alert()')
element = described_class.new(:name => 'script', :children => [text])
document = Oga::XML::Document.new(:type => :html, :children => [element])
diff --git a/spec/oga/xml/entities_spec.rb b/spec/oga/xml/entities_spec.rb
index fbfce69..84346f3 100644
--- a/spec/oga/xml/entities_spec.rb
+++ b/spec/oga/xml/entities_spec.rb
@@ -1,98 +1,98 @@
require 'spec_helper'
describe Oga::XML::Entities do
- context 'decode' do
- example 'decode < into <' do
+ describe 'decode' do
+ it 'decodes < into <' do
described_class.decode('<').should == '<'
end
- example 'decode > into >' do
+ it 'decodes > into >' do
described_class.decode('>').should == '>'
end
- example "decode ' into '" do
+ it "decodes ' into '" do
described_class.decode(''').should == "'"
end
- example 'decode " into "' do
+ it 'decodes " into "' do
described_class.decode('"').should == '"'
end
- example 'decode & into &' do
+ it 'decodes & into &' do
described_class.decode('&').should == '&'
end
- example 'decode < into <' do
+ it 'decodes < into <' do
described_class.decode('<').should == '<'
end
- example 'decode > into >' do
+ it 'decodes > into >' do
described_class.decode('>').should == '>'
end
- example "decode ' into '" do
+ it "decodes ' into '" do
described_class.decode(''').should == "'"
end
- example 'decode " into "' do
+ it 'decodes " into "' do
described_class.decode('"').should == '"'
end
- example 'decode & into &' do
+ it 'decodes & into &' do
described_class.decode('&').should == '&'
end
- example 'decode < into <' do
+ it 'decodes < into <' do
described_class.decode('<').should == '<'
end
- example 'decode & into &' do
+ it 'decodes & into &' do
described_class.decode('&').should == '&'
end
- example 'decode > into >' do
+ it 'decodes > into >' do
described_class.decode('>').should == '>'
end
- example 'decode &> into &>' do
+ it 'decodes &> into &>' do
described_class.decode('&>').should == '&>'
end
- example 'decode < into <' do
+ it 'decodes < into <' do
described_class.decode('<').should == '<'
end
- example 'decode &< into &<' do
+ it 'decodes &< into &<' do
described_class.decode('&<').should == '&<'
end
end
- context 'encode' do
- example 'encode & as &' do
+ describe 'encode' do
+ it 'encodes & as &' do
described_class.encode('&').should == '&'
end
- example 'encode " as "' do
+ it 'encodes " as "' do
described_class.encode('"').should == '"'
end
- example "encode ' as '" do
+ it "encodes ' as '" do
described_class.encode("'").should == '''
end
- example 'encode < as <' do
+ it 'encodes < as <' do
described_class.encode('<').should == '<'
end
- example 'encode > as >' do
+ it 'encodes > as >' do
described_class.encode('>').should == '>'
end
- example 'encode > as >' do
+ it 'encodes > as >' do
described_class.encode('>').should == '>'
end
- example 'encode < as <' do
+ it 'encodes < as <' do
described_class.encode('<').should == '<'
end
end
diff --git a/spec/oga/xml/lexer/cdata_spec.rb b/spec/oga/xml/lexer/cdata_spec.rb
index f926747..82c304e 100644
--- a/spec/oga/xml/lexer/cdata_spec.rb
+++ b/spec/oga/xml/lexer/cdata_spec.rb
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'cdata tags' do
- example 'lex a cdata tag' do
+ describe 'cdata tags' do
+ it 'lexes a cdata tag' do
lex('').should == [[:T_CDATA, 'foo', 1]]
end
- example 'lex tags inside CDATA tags as regular text' do
+ it 'lexes tags inside CDATA tags as regular text' do
lex('Foo
]]>').should == [[:T_CDATA, '
Foo
', 1]]
end
- example 'lex double brackets inside a CDATA tag' do
+ it 'lexes double brackets inside a CDATA tag' do
lex('').should == [[:T_CDATA, ']]', 1]]
end
- example 'lex two CDATA tags following each other' do
+ it 'lexes two CDATA tags following each other' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'a', 1],
diff --git a/spec/oga/xml/lexer/comments_spec.rb b/spec/oga/xml/lexer/comments_spec.rb
index 34cb54b..fe29603 100644
--- a/spec/oga/xml/lexer/comments_spec.rb
+++ b/spec/oga/xml/lexer/comments_spec.rb
@@ -1,34 +1,34 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'comments' do
- example 'lex a comment' do
+ describe 'comments' do
+ it 'lexes a comment' do
lex('').should == [[:T_COMMENT, ' foo ', 1]]
end
- example 'lex a comment containing --' do
+ it 'lexes a comment containing --' do
lex('').should == [[:T_COMMENT, ' -- ', 1]]
end
- example 'lex a comment containing ->' do
+ it 'lexes a comment containing ->' do
lex('').should == [[:T_COMMENT, ' -> ', 1]]
end
- example 'lex a comment followed by text' do
+ it 'lexes a comment followed by text' do
lex('foo').should == [
[:T_COMMENT, '', 1],
[:T_TEXT, 'foo', 1]
]
end
- example 'lex text followed by a comment' do
+ it 'lexes text followed by a comment' do
lex('foo').should == [
[:T_TEXT, 'foo', 1],
[:T_COMMENT, '', 1]
]
end
- example 'lex an element followed by a comment' do
+ it 'lexes an element followed by a comment' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -37,7 +37,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex two comments following each other' do
+ it 'lexes two comments following each other' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'a', 1],
diff --git a/spec/oga/xml/lexer/doctype_spec.rb b/spec/oga/xml/lexer/doctype_spec.rb
index f38470d..3749b37 100644
--- a/spec/oga/xml/lexer/doctype_spec.rb
+++ b/spec/oga/xml/lexer/doctype_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'doctypes' do
- example 'lex the HTML5 doctype' do
+ describe 'doctypes' do
+ it 'lexes the HTML5 doctype' do
lex('').should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'html', 1],
@@ -10,7 +10,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a doctype with a public and system ID' do
+ it 'lexes a doctype with a public and system ID' do
lex('').should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'HTML', 1],
@@ -25,7 +25,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a doctype with a public and system ID using single quotes' do
+ it 'lexes a doctype with a public and system ID using single quotes' do
lex("").should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'HTML', 1],
@@ -40,7 +40,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an inline doctype' do
+ it 'lexes an inline doctype' do
lex(']>').should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'html', 1],
@@ -49,7 +49,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an empty inline doctype' do
+ it 'lexes an empty inline doctype' do
lex('').should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'html', 1],
@@ -57,7 +57,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an inline doctype containing a newline' do
+ it 'lexes an inline doctype containing a newline' do
lex("").should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'html', 1],
@@ -66,7 +66,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an inline doctype containing a trailing newline using an IO' do
+ it 'lexes an inline doctype containing a trailing newline using an IO' do
input = StringIO.new("")
lex(input).should == [
@@ -77,7 +77,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an inline doctype containing a leading newline using an IO' do
+ it 'lexes an inline doctype containing a leading newline using an IO' do
input = StringIO.new("")
lex(input).should == [
@@ -91,7 +91,7 @@ describe Oga::XML::Lexer do
# Technically not valid, put in place to make sure that the Ragel rules are
# not too greedy.
- example 'lex an inline doftype followed by a system ID' do
+ it 'lexes an inline doftype followed by a system ID' do
lex('] "foo">').should == [
[:T_DOCTYPE_START, nil, 1],
[:T_DOCTYPE_NAME, 'html', 1],
diff --git a/spec/oga/xml/lexer/documents_spec.rb b/spec/oga/xml/lexer/documents_spec.rb
index 3aee616..2b9c689 100644
--- a/spec/oga/xml/lexer/documents_spec.rb
+++ b/spec/oga/xml/lexer/documents_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'HTML documents' do
- example 'lex a basic HTML document' do
+ describe 'HTML documents' do
+ it 'lexes a basic HTML document' do
html = <<-EOF
diff --git a/spec/oga/xml/lexer/elements_spec.rb b/spec/oga/xml/lexer/elements_spec.rb
index 079bbd4..59a76ec 100644
--- a/spec/oga/xml/lexer/elements_spec.rb
+++ b/spec/oga/xml/lexer/elements_spec.rb
@@ -1,15 +1,15 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'elements' do
- example 'lex an opening element' do
+ describe 'elements' do
+ it 'lexes an opening element' do
lex('
').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1]
]
end
- example 'lex an opening an closing element' do
+ it 'lexes an opening an closing element' do
lex('
').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -17,7 +17,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a paragraph element with text inside it' do
+ it 'lexes a paragraph element with text inside it' do
lex('
Hello
').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -26,7 +26,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex text followed by a paragraph element' do
+ it 'lexes text followed by a paragraph element' do
lex('Foo
').should == [
[:T_TEXT, 'Foo', 1],
[:T_ELEM_START, nil, 1],
@@ -34,7 +34,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an element with a newline in the open tag' do
+ it 'lexes an element with a newline in the open tag' do
lex("
").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -43,8 +43,8 @@ describe Oga::XML::Lexer do
end
end
- context 'elements with attributes' do
- example 'lex an element with an attribute without a value' do
+ describe 'elements with attributes' do
+ it 'lexes an element with an attribute without a value' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -53,7 +53,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an element with an attribute with an empty value' do
+ it 'lexes an element with an attribute with an empty value' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -64,7 +64,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a paragraph element with attributes' do
+ it 'lexes a paragraph element with attributes' do
lex('
Hello
').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -77,7 +77,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a paragraph element with a newline in an attribute' do
+ it 'lexes a paragraph element with a newline in an attribute' do
lex("
Hello
").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -90,7 +90,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a paragraph element with single quoted attributes' do
+ it 'lexes a paragraph element with single quoted attributes' do
lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -102,7 +102,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a paragraph element with a namespaced attribute' do
+ it 'lexes a paragraph element with a namespaced attribute' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -116,8 +116,8 @@ describe Oga::XML::Lexer do
end
end
- context 'nested elements' do
- example 'lex a nested element' do
+ describe 'nested elements' do
+ it 'lexes a nested element' do
lex('
').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -128,7 +128,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex nested elements and text nodes' do
+ it 'lexes nested elements and text nodes' do
lex('
').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -143,8 +143,8 @@ describe Oga::XML::Lexer do
end
end
- context 'void elements' do
- example 'lex a void element' do
+ describe 'void elements' do
+ it 'lexes a void element' do
lex(' ').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'br', 1],
@@ -152,7 +152,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a void element with an attribute' do
+ it 'lexes a void element with an attribute' do
lex(' ').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'br', 1],
@@ -165,8 +165,8 @@ describe Oga::XML::Lexer do
end
end
- context 'elements with namespaces' do
- example 'lex an element with namespaces' do
+ describe 'elements with namespaces' do
+ it 'lexes an element with namespaces' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NS, 'foo', 1],
@@ -175,7 +175,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an element with a start and end namespace' do
+ it 'lexes an element with a start and end namespace' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NS, 'foo', 1],
diff --git a/spec/oga/xml/lexer/entities_spec.rb b/spec/oga/xml/lexer/entities_spec.rb
index 3dd2021..f124623 100644
--- a/spec/oga/xml/lexer/entities_spec.rb
+++ b/spec/oga/xml/lexer/entities_spec.rb
@@ -1,22 +1,22 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'converting XML entities in text tokens' do
- example 'convert & into &' do
+ describe 'converting XML entities in text tokens' do
+ it 'converts & into &' do
lex('&').should == [[:T_TEXT, '&', 1]]
end
- example 'convert < into <' do
+ it 'converts < into <' do
lex('<').should == [[:T_TEXT, '<', 1]]
end
- example 'convert > into >' do
+ it 'converts > into >' do
lex('>').should == [[:T_TEXT, '>', 1]]
end
end
- context 'converting XML entities in string tokens' do
- example 'convert & into &' do
+ describe 'converting XML entities in string tokens' do
+ it 'converts & into &' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'foo', 1],
@@ -28,7 +28,7 @@ describe Oga::XML::Lexer do
]
end
- example 'convert < into <' do
+ it 'converts < into <' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'foo', 1],
@@ -40,7 +40,7 @@ describe Oga::XML::Lexer do
]
end
- example 'convert > into >' do
+ it 'converts > into >' do
lex('').should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'foo', 1],
diff --git a/spec/oga/xml/lexer/enumerator_spec.rb b/spec/oga/xml/lexer/enumerator_spec.rb
index afda915..6486d18 100644
--- a/spec/oga/xml/lexer/enumerator_spec.rb
+++ b/spec/oga/xml/lexer/enumerator_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'Enumerator as input' do
+ describe 'Enumerator as input' do
before do
@enum = Enumerator.new do |yielder|
yielder << '
foo'
@@ -9,7 +9,7 @@ describe Oga::XML::Lexer do
end
end
- example 'lex a paragraph element' do
+ it 'lexes a paragraph element' do
lex(@enum).should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'p', 1],
@@ -18,7 +18,7 @@ describe Oga::XML::Lexer do
]
end
- example 'rewind input when resetting the lexer' do
+ it 'rewinds input when resetting the lexer' do
lexer = described_class.new(@enum)
lexer.lex.empty?.should == false
diff --git a/spec/oga/xml/lexer/general_spec.rb b/spec/oga/xml/lexer/general_spec.rb
index fe95ad9..f9b3105 100644
--- a/spec/oga/xml/lexer/general_spec.rb
+++ b/spec/oga/xml/lexer/general_spec.rb
@@ -1,36 +1,36 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'regular text' do
- example 'lex regular text' do
+ describe 'regular text' do
+ it 'lexes regular text' do
lex('hello').should == [[:T_TEXT, 'hello', 1]]
end
- example 'lex regular whitespace' do
+ it 'lexes regular whitespace' do
lex(' ').should == [[:T_TEXT, ' ', 1]]
end
- example 'lex a newline' do
+ it 'lexes a newline' do
lex("\n").should == [[:T_TEXT, "\n", 1]]
end
- example 'lex text followed by a newline' do
+ it 'lexes text followed by a newline' do
lex("foo\n").should == [[:T_TEXT, "foo\n", 1]]
end
- example 'lex a > as regular text' do
+ it 'lexes a > as regular text' do
lex('>').should == [[:T_TEXT, '>', 1]]
end
- example 'lex as regular text' do
+ it 'lexes as regular text' do
lex('').should == [[:T_TEXT, '', 1]]
end
- example 'lex ', :html => true).should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'link', 1],
@@ -10,7 +10,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a upper case void element' do
+ it 'lexes a upper case void element' do
lex(' ', :html => true).should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, "BR", 1],
@@ -18,7 +18,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex text after a void element' do
+ it 'lexes text after a void element' do
lex('foo', :html => true).should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'link', 1],
@@ -27,7 +27,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a void element inside another element' do
+ it 'lexes a void element inside another element' do
lex('
', :html => true).should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'head', 1],
@@ -38,7 +38,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a void element inside another element with whitespace' do
+ it 'lexes a void element inside another element with whitespace' do
lex("\n", :html => true).should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'head', 1],
diff --git a/spec/oga/xml/lexer/inline_javascript_spec.rb b/spec/oga/xml/lexer/inline_javascript_spec.rb
index 418c2a0..9ffc944 100644
--- a/spec/oga/xml/lexer/inline_javascript_spec.rb
+++ b/spec/oga/xml/lexer/inline_javascript_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'lexing inline Javascript' do
+ describe 'lexing inline Javascript' do
before do
@javascript = 'if ( number < 10 ) { }'
end
- example 'lex inline Javascript' do
+ it 'lexes inline Javascript' do
lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'script', 1],
@@ -15,7 +15,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex inline Javascript containing an XML comment' do
+ it 'lexes inline Javascript containing an XML comment' do
lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'script', 1],
@@ -25,7 +25,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex inline Javascript containing a CDATA tag' do
+ it 'lexes inline Javascript containing a CDATA tag' do
lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'script', 1],
@@ -35,7 +35,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex inline Javascript containing a processing instruction' do
+ it 'lexes inline Javascript containing a processing instruction' do
lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'script', 1],
@@ -47,7 +47,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex inline Javascript containing another element' do
+ it 'lexes inline Javascript containing another element' do
lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'script', 1],
diff --git a/spec/oga/xml/lexer/io_spec.rb b/spec/oga/xml/lexer/io_spec.rb
index 2fe3a52..a630c6f 100644
--- a/spec/oga/xml/lexer/io_spec.rb
+++ b/spec/oga/xml/lexer/io_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'IO as input' do
- example 'lex a paragraph element with attributes' do
+ describe 'IO as input' do
+ it 'lexes a paragraph element with attributes' do
io = StringIO.new("
\nHello
")
lex(io).should == [
@@ -18,7 +18,7 @@ describe Oga::XML::Lexer do
]
end
- example 'rewind input when resetting the lexer' do
+ it 'rewinds input when resetting the lexer' do
io = StringIO.new("
\nHello
")
lexer = described_class.new(io)
@@ -26,7 +26,7 @@ describe Oga::XML::Lexer do
lexer.lex.empty?.should == false
end
- example 'lex an attribute value starting with a newline' do
+ it 'lexes an attribute value starting with a newline' do
io = StringIO.new("")
lexer = described_class.new(io)
@@ -42,7 +42,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex an attribute value split in two by a newline' do
+ it 'lexes an attribute value split in two by a newline' do
io = StringIO.new("")
lexer = described_class.new(io)
diff --git a/spec/oga/xml/lexer/multibyte_spec.rb b/spec/oga/xml/lexer/multibyte_spec.rb
index d1ea493..7b24fe4 100644
--- a/spec/oga/xml/lexer/multibyte_spec.rb
+++ b/spec/oga/xml/lexer/multibyte_spec.rb
@@ -3,8 +3,8 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'multibyte text nodes' do
- example 'lex a multibyte text node' do
+ describe 'multibyte text nodes' do
+ it 'lexes a multibyte text node' do
lex('ì¿ í‚¤').should == [[:T_TEXT, 'ì¿ í‚¤', 1]]
end
end
diff --git a/spec/oga/xml/lexer/processing_instruction_spec.rb b/spec/oga/xml/lexer/processing_instruction_spec.rb
index 80648e8..dd69059 100644
--- a/spec/oga/xml/lexer/processing_instruction_spec.rb
+++ b/spec/oga/xml/lexer/processing_instruction_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'processing instructions' do
- example 'lex a processing instruction' do
+ describe 'processing instructions' do
+ it 'lexes a processing instruction' do
lex('').should == [
[:T_PROC_INS_START, nil, 1],
[:T_PROC_INS_NAME, 'foo', 1],
@@ -10,7 +10,7 @@ describe Oga::XML::Lexer do
]
end
- example 'lex a processing instruction containing text' do
+ it 'lexes a processing instruction containing text' do
lex('').should == [
[:T_PROC_INS_START, nil, 1],
[:T_PROC_INS_NAME, 'foo', 1],
diff --git a/spec/oga/xml/lexer/xml_declaration_spec.rb b/spec/oga/xml/lexer/xml_declaration_spec.rb
index 8459592..1df8485 100644
--- a/spec/oga/xml/lexer/xml_declaration_spec.rb
+++ b/spec/oga/xml/lexer/xml_declaration_spec.rb
@@ -1,19 +1,19 @@
require 'spec_helper'
describe Oga::XML::Lexer do
- context 'XML declaration tags' do
- example 'lex a start tag' do
+ describe 'XML declaration tags' do
+ it 'lexes a start tag' do
lex('').should == [
[:T_XML_DECL_START, nil, 1],
[:T_XML_DECL_END, nil, 1]
]
end
- example 'lex a tag with text inside it' do
+ it 'lexes a tag with text inside it' do
lex('').should == [
[:T_XML_DECL_START, nil, 1],
[:T_ATTR, 'version', 1],
diff --git a/spec/oga/xml/namespace_spec.rb b/spec/oga/xml/namespace_spec.rb
index 58b9a75..1ddf80a 100644
--- a/spec/oga/xml/namespace_spec.rb
+++ b/spec/oga/xml/namespace_spec.rb
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Oga::XML::Namespace do
- context '#initialize' do
- example 'set the name' do
+ describe '#initialize' do
+ it 'sets the name' do
described_class.new(:name => 'a').name.should == 'a'
end
end
- context '#to_s' do
- example 'convert the Namespace to a String' do
+ describe '#to_s' do
+ it 'converts the Namespace to a String' do
described_class.new(:name => 'x').to_s.should == 'x'
end
end
- context '#inspect' do
- example 'return the inspect value' do
+ describe '#inspect' do
+ it 'returns the inspect value' do
ns = described_class.new(:name => 'x', :uri => 'y')
ns.inspect.should == 'Namespace(name: "x" uri: "y")'
diff --git a/spec/oga/xml/node_set_spec.rb b/spec/oga/xml/node_set_spec.rb
index 0197db1..6a78b01 100644
--- a/spec/oga/xml/node_set_spec.rb
+++ b/spec/oga/xml/node_set_spec.rb
@@ -1,32 +1,32 @@
require 'spec_helper'
describe Oga::XML::NodeSet do
- context '#initialize' do
- example 'create an empty node set' do
+ describe '#initialize' do
+ it 'creates an empty node set' do
described_class.new.length.should == 0
end
- example 'create a node set with a single node' do
+ it 'creates a node set with a single node' do
node = Oga::XML::Element.new(:name => 'p')
described_class.new([node]).length.should == 1
end
- example 'set the owner of a set' do
+ it 'sets the owner of a set' do
node = Oga::XML::Element.new
set = described_class.new([], node)
set.owner.should == node
end
- example 'take ownership of the nodes when the set has an owner' do
+ it 'takes ownership of the nodes when the set has an owner' do
node = Oga::XML::Element.new
set = described_class.new([node], node)
node.node_set.should == set
end
- example 'only store unique nodes' do
+ it 'onlies store unique nodes' do
n1 = Oga::XML::Element.new(:name => 'a')
set = described_class.new([n1, n1])
@@ -34,8 +34,8 @@ describe Oga::XML::NodeSet do
end
end
- context '#each' do
- example 'yield the block for every node' do
+ describe '#each' do
+ it 'yields the block for every node' do
n1 = Oga::XML::Element.new(:name => 'a')
n2 = Oga::XML::Element.new(:name => 'b')
@@ -48,60 +48,60 @@ describe Oga::XML::NodeSet do
end
end
- context 'Enumerable behaviour' do
+ describe 'Enumerable behaviour' do
before do
@n1 = Oga::XML::Element.new(:name => 'a')
@n2 = Oga::XML::Element.new(:name => 'b')
@set = described_class.new([@n1, @n2])
end
- example 'return the first node' do
+ it 'returns the first node' do
@set.first.should == @n1
end
- example 'return the last node' do
+ it 'returns the last node' do
@set.last.should == @n2
end
- example 'return the amount of nodes' do
+ it 'returns the amount of nodes' do
@set.count.should == 2
@set.length.should == 2
@set.size.should == 2
end
- example 'return a boolean that indicates if a set is empty or not' do
+ it 'returns a boolean that indicates if a set is empty or not' do
@set.empty?.should == false
end
end
- context '#index' do
+ describe '#index' do
before do
@n1 = Oga::XML::Element.new(:name => 'a')
@n2 = Oga::XML::Element.new(:name => 'b')
@set = described_class.new([@n1, @n2])
end
- example 'return the index of the first node' do
+ it 'returns the index of the first node' do
@set.index(@n1).should == 0
end
- example 'return the index of the last node' do
+ it 'returns the index of the last node' do
@set.index(@n2).should == 1
end
end
- context '#push' do
+ describe '#push' do
before do
@set = described_class.new
end
- example 'push a node into the set' do
+ it 'pushes a node into the set' do
@set.push(Oga::XML::Element.new(:name => 'a'))
@set.length.should == 1
end
- example 'do not push a node that is already part of the set' do
+ it 'does not push a node that is already part of the set' do
element = Oga::XML::Element.new(:name => 'a')
@set.push(element)
@@ -110,7 +110,7 @@ describe Oga::XML::NodeSet do
@set.length.should == 1
end
- example 'take ownership of a node if the set has an owner' do
+ it 'takes ownership of a node if the set has an owner' do
child = Oga::XML::Element.new
@set.owner = Oga::XML::Element.new
@@ -120,13 +120,13 @@ describe Oga::XML::NodeSet do
end
end
- context '#unshift' do
+ describe '#unshift' do
before do
@n1 = Oga::XML::Element.new(:name => 'a')
@set = described_class.new([@n1])
end
- example 'push a node at the beginning of the set' do
+ it 'pushes a node at the beginning of the set' do
n2 = Oga::XML::Element.new(:name => 'b')
@set.unshift(n2)
@@ -134,13 +134,13 @@ describe Oga::XML::NodeSet do
@set.first.should == n2
end
- example 'do not push a node if it is already part of the set' do
+ it 'does not push a node if it is already part of the set' do
@set.unshift(@n1)
@set.length.should == 1
end
- example 'take ownership of a node if the set has an owner' do
+ it 'takes ownership of a node if the set has an owner' do
child = Oga::XML::Element.new
@set.owner = Oga::XML::Element.new
@@ -150,59 +150,59 @@ describe Oga::XML::NodeSet do
end
end
- context '#shift' do
+ describe '#shift' do
before do
owner = Oga::XML::Element.new
@n1 = Oga::XML::Element.new
@set = described_class.new([@n1], owner)
end
- example 'remove the node from the set' do
+ it 'removes the node from the set' do
@set.shift
@set.empty?.should == true
end
- example 'return the node when shifting it' do
+ it 'returns the node when shifting it' do
@set.shift.should == @n1
end
- example 'remove ownership if the node belongs to a node set' do
+ it 'removes ownership if the node belongs to a node set' do
@set.shift
@n1.node_set.nil?.should == true
end
end
- context '#pop' do
+ describe '#pop' do
before do
owner = Oga::XML::Element.new
@n1 = Oga::XML::Element.new
@set = described_class.new([@n1], owner)
end
- example 'remove the node from the set' do
+ it 'removes the node from the set' do
@set.pop
@set.empty?.should == true
end
- example 'return the node when popping it' do
+ it 'returns the node when popping it' do
@set.pop.should == @n1
end
- example 'remove ownership if the node belongs to a node set' do
+ it 'removes ownership if the node belongs to a node set' do
@set.pop
@n1.node_set.nil?.should == true
end
end
- context '#insert' do
+ describe '#insert' do
before do
@set = described_class.new
@owned_set = described_class.new([], Oga::XML::Node.new)
end
- example 'insert a node into an empty node set' do
+ it 'inserts a node into an empty node set' do
node = Oga::XML::Node.new
@set.insert(0, node)
@@ -210,7 +210,7 @@ describe Oga::XML::NodeSet do
@set[0].should == node
end
- example 'do not insert a node that is already in the set' do
+ it 'does not insert a node that is already in the set' do
node = Oga::XML::Node.new
@set.insert(0, node)
@@ -219,7 +219,7 @@ describe Oga::XML::NodeSet do
@set.length.should == 1
end
- example 'insert a node before another node' do
+ it 'inserts a node before another node' do
node1 = Oga::XML::Node.new
node2 = Oga::XML::Node.new
@@ -230,7 +230,7 @@ describe Oga::XML::NodeSet do
@set[1].should == node1
end
- example 'take ownership of a node when inserting into an owned set' do
+ it 'takes ownership of a node when inserting into an owned set' do
node = Oga::XML::Node.new
@owned_set.insert(0, node)
@@ -239,29 +239,29 @@ describe Oga::XML::NodeSet do
end
end
- context '#[]' do
+ describe '#[]' do
before do
@n1 = Oga::XML::Element.new(:name => 'a')
@set = described_class.new([@n1])
end
- example 'return a node from a given index' do
+ it 'returns a node from a given index' do
@set[0].should == @n1
end
end
- context '#to_a' do
+ describe '#to_a' do
before do
@n1 = Oga::XML::Element.new(:name => 'a')
@set = described_class.new([@n1])
end
- example 'convert a set to an Array' do
+ it 'converts a set to an Array' do
@set.to_a.should == [@n1]
end
end
- context '#+' do
+ describe '#+' do
before do
@n1 = Oga::XML::Element.new(:name => 'a')
@n2 = Oga::XML::Element.new(:name => 'b')
@@ -269,16 +269,16 @@ describe Oga::XML::NodeSet do
@set2 = described_class.new([@n2])
end
- example 'merge two sets together' do
+ it 'merges two sets together' do
(@set1 + @set2).to_a.should == [@n1, @n2]
end
- example 'ignore duplicate nodes' do
+ it 'ignores duplicate nodes' do
(@set1 + described_class.new([@n1])).length.should == 1
end
end
- context '#==' do
+ describe '#==' do
before do
node = Oga::XML::Node.new
@set1 = described_class.new([node])
@@ -286,16 +286,16 @@ describe Oga::XML::NodeSet do
@set3 = described_class.new
end
- example 'return true if two node sets are equal' do
+ it 'returns true if two node sets are equal' do
@set1.should == @set2
end
- example 'return false if two node sets are not equal' do
+ it 'returns false if two node sets are not equal' do
@set1.should_not == @set3
end
end
- context '#concat' do
+ describe '#concat' do
before do
n1 = Oga::XML::Element.new(:name => 'a')
n2 = Oga::XML::Element.new(:name => 'b')
@@ -304,14 +304,14 @@ describe Oga::XML::NodeSet do
@set2 = described_class.new([n2])
end
- example 'concatenate two node sets' do
+ it 'concatenates two node sets' do
@set1.concat(@set2)
@set1.length.should == 2
end
end
- context '#remove' do
+ describe '#remove' do
before do
owner = Oga::XML::Element.new
@n1 = Oga::XML::Element.new
@@ -321,57 +321,57 @@ describe Oga::XML::NodeSet do
@query_set = described_class.new([@n1, @n2])
end
- example 'do not remove the nodes from the current set' do
+ it 'does not remove the nodes from the current set' do
@query_set.remove
@query_set.empty?.should == false
end
- example 'remove the nodes from the owning set' do
+ it 'removes the nodes from the owning set' do
@query_set.remove
@doc_set.empty?.should == true
end
- example 'unlink the nodes from the sets they belong to' do
+ it 'unlinks the nodes from the sets they belong to' do
@query_set.remove
@n1.node_set.nil?.should == true
@n2.node_set.nil?.should == true
end
- example 'remove all nodes from the owned set' do
+ it 'removes all nodes from the owned set' do
@doc_set.remove
@doc_set.empty?.should == true
end
end
- context '#delete' do
+ describe '#delete' do
before do
owner = Oga::XML::Element.new
@n1 = Oga::XML::Element.new
@set = described_class.new([@n1], owner)
end
- example 'return the node when deleting it' do
+ it 'returns the node when deleting it' do
@set.delete(@n1).should == @n1
end
- example 'remove the node from the set' do
+ it 'removes the node from the set' do
@set.delete(@n1)
@set.empty?.should == true
end
- example 'remove ownership of the removed node' do
+ it 'removes ownership of the removed node' do
@set.delete(@n1)
@n1.node_set.nil?.should == true
end
end
- context '#attribute' do
+ describe '#attribute' do
before do
@attr = Oga::XML::Attribute.new(:name => 'a', :value => '1')
@el = Oga::XML::Element.new(:name => 'a', :attributes => [@attr])
@@ -379,12 +379,12 @@ describe Oga::XML::NodeSet do
@set = described_class.new([@el, @txt])
end
- example 'return the values of an attribute' do
+ it 'returns the values of an attribute' do
@set.attribute('a').should == [@attr]
end
end
- context '#text' do
+ describe '#text' do
before do
child = Oga::XML::Text.new(:text => 'foo')
comment = Oga::XML::Comment.new(:text => 'bar')
@@ -399,7 +399,7 @@ describe Oga::XML::NodeSet do
@set = described_class.new([@el, text])
end
- example 'return the text of all nodes' do
+ it 'returns the text of all nodes' do
@set.text.should == "foobaz\nbar"
end
end
diff --git a/spec/oga/xml/node_spec.rb b/spec/oga/xml/node_spec.rb
index 7b519a3..e35b207 100644
--- a/spec/oga/xml/node_spec.rb
+++ b/spec/oga/xml/node_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XML::Node do
- context '#initialize' do
- example 'set the node set' do
+ describe '#initialize' do
+ it 'sets the node set' do
set = Oga::XML::NodeSet.new
node = described_class.new(:node_set => set)
@@ -10,12 +10,12 @@ describe Oga::XML::Node do
end
end
- context '#children' do
- example 'return an empty set by default' do
+ describe '#children' do
+ it 'returns an empty set by default' do
described_class.new.children.empty?.should == true
end
- example 'return a set that was created manually' do
+ it 'returns a set that was created manually' do
set = Oga::XML::NodeSet.new([described_class.new])
node = described_class.new(:children => set)
@@ -23,8 +23,8 @@ describe Oga::XML::Node do
end
end
- context '#children=' do
- example 'set the child nodes using an Array' do
+ describe '#children=' do
+ it 'sets the child nodes using an Array' do
child = described_class.new
node = described_class.new
@@ -33,7 +33,7 @@ describe Oga::XML::Node do
node.children[0].should == child
end
- example 'set the child nodes using a NodeSet' do
+ it 'sets the child nodes using a NodeSet' do
child = described_class.new
node = described_class.new
@@ -43,8 +43,8 @@ describe Oga::XML::Node do
end
end
- context '#parent' do
- example 'return the parent of the node' do
+ describe '#parent' do
+ it 'returns the parent of the node' do
owner = described_class.new
set = Oga::XML::NodeSet.new([], owner)
node = described_class.new(:node_set => set)
@@ -52,12 +52,12 @@ describe Oga::XML::Node do
node.parent.should == owner
end
- example 'return nil if there is no parent node' do
+ it 'returns nil if there is no parent node' do
described_class.new.parent.nil?.should == true
end
end
- context '#previous' do
+ describe '#previous' do
before do
owner = described_class.new
@n1 = described_class.new
@@ -65,16 +65,16 @@ describe Oga::XML::Node do
@set = Oga::XML::NodeSet.new([@n1, @n2], owner)
end
- example 'return the previous node' do
+ it 'returns the previous node' do
@n2.previous.should == @n1
end
- example 'return nil if there is no previous node' do
+ it 'returns nil if there is no previous node' do
@n1.previous.nil?.should == true
end
end
- context '#next' do
+ describe '#next' do
before do
owner = described_class.new
@n1 = described_class.new
@@ -82,16 +82,16 @@ describe Oga::XML::Node do
@set = Oga::XML::NodeSet.new([@n1, @n2], owner)
end
- example 'return the next node' do
+ it 'returns the next node' do
@n1.next.should == @n2
end
- example 'return nil if there is no previous node' do
+ it 'returns nil if there is no previous node' do
@n2.next.nil?.should == true
end
end
- context '#previous_element' do
+ describe '#previous_element' do
before do
owner = described_class.new
@n1 = Oga::XML::Element.new
@@ -100,20 +100,20 @@ describe Oga::XML::Node do
@set = Oga::XML::NodeSet.new([@n1, @n2, @n3], owner)
end
- example 'return the previous element of a generic node' do
+ it 'returns the previous element of a generic node' do
@n3.previous_element.should == @n1
end
- example 'return the previous element of a text node' do
+ it 'returns the previous element of a text node' do
@n2.previous_element.should == @n1
end
- example 'return nil if there is no previous element' do
+ it 'returns nil if there is no previous element' do
@n1.previous_element.nil?.should == true
end
end
- context '#next_element' do
+ describe '#next_element' do
before do
owner = described_class.new
@n1 = described_class.new
@@ -122,20 +122,20 @@ describe Oga::XML::Node do
@set = Oga::XML::NodeSet.new([@n1, @n2, @n3], owner)
end
- example 'return the next element of a generic node' do
+ it 'returns the next element of a generic node' do
@n1.next_element.should == @n3
end
- example 'return the next element of a text node' do
+ it 'returns the next element of a text node' do
@n2.next_element.should == @n3
end
- example 'return nil if there is no next element' do
+ it 'returns nil if there is no next element' do
@n3.next_element.nil?.should == true
end
end
- context '#root_node' do
+ describe '#root_node' do
before do
@n4 = described_class.new
@n3 = described_class.new(:children => [@n4])
@@ -144,42 +144,42 @@ describe Oga::XML::Node do
@doc = Oga::XML::Document.new(:children => [@n1])
end
- example 'return the root document of an element' do
+ it 'returns the root document of an element' do
@n2.root_node.should == @doc
end
- example 'return the root element of another element' do
+ it 'returns the root element of another element' do
@n4.root_node.should == @n3
end
end
- context '#remove' do
+ describe '#remove' do
before do
owner = described_class.new
@n1 = described_class.new
@set = Oga::XML::NodeSet.new([@n1], owner)
end
- example 'return a node from the node set' do
+ it 'returns a node from the node set' do
@n1.remove
@set.empty?.should == true
end
- example 'remove the reference to the set' do
+ it 'removes the reference to the set' do
@n1.remove
@n1.node_set.nil?.should == true
end
end
- context '#before' do
+ describe '#before' do
before do
@node = described_class.new
@container = described_class.new(:children => [@node])
end
- example 'insert a node before another node' do
+ it 'inserts a node before another node' do
other = described_class.new
@node.before(other)
@@ -189,13 +189,13 @@ describe Oga::XML::Node do
end
end
- context '#after' do
+ describe '#after' do
before do
@node = described_class.new
@container = described_class.new(:children => [@node])
end
- example 'insert a node after another node' do
+ it 'inserts a node after another node' do
other = described_class.new
@node.after(other)
diff --git a/spec/oga/xml/parser/cdata_spec.rb b/spec/oga/xml/parser/cdata_spec.rb
index c96a974..09c2898 100644
--- a/spec/oga/xml/parser/cdata_spec.rb
+++ b/spec/oga/xml/parser/cdata_spec.rb
@@ -1,36 +1,36 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'empty cdata tags' do
+ describe 'empty cdata tags' do
before :all do
@node = parse('').children[0]
end
- example 'return a Cdata instance' do
+ it 'returns a Cdata instance' do
@node.is_a?(Oga::XML::Cdata).should == true
end
end
- context 'cdata tags with text' do
+ describe 'cdata tags with text' do
before :all do
@node = parse('').children[0]
end
- example 'return a Cdata instance' do
+ it 'returns a Cdata instance' do
@node.is_a?(Oga::XML::Cdata).should == true
end
- example 'set the text of the tag' do
+ it 'sets the text of the tag' do
@node.text.should == 'foo'
end
end
- context 'cdata tags with nested elements' do
+ describe 'cdata tags with nested elements' do
before :all do
@node = parse('foo]]>').children[0]
end
- example 'set the HTML as raw text' do
+ it 'sets the HTML as raw text' do
@node.text.should == '
foo
'
end
end
diff --git a/spec/oga/xml/parser/comments_spec.rb b/spec/oga/xml/parser/comments_spec.rb
index e201a8e..c408edb 100644
--- a/spec/oga/xml/parser/comments_spec.rb
+++ b/spec/oga/xml/parser/comments_spec.rb
@@ -1,26 +1,26 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'empty comments' do
+ describe 'empty comments' do
before :all do
@node = parse('').children[0]
end
- example 'return a Comment instance' do
+ it 'returns a Comment instance' do
@node.is_a?(Oga::XML::Comment).should == true
end
end
- context 'comments with text' do
+ describe 'comments with text' do
before :all do
@node = parse('').children[0]
end
- example 'return a Comment instance' do
+ it 'returns a Comment instance' do
@node.is_a?(Oga::XML::Comment).should == true
end
- example 'set the text of the comment' do
+ it 'sets the text of the comment' do
@node.text.should == 'foo'
end
end
diff --git a/spec/oga/xml/parser/doctype_spec.rb b/spec/oga/xml/parser/doctype_spec.rb
index 9bf4fa7..6e50002 100644
--- a/spec/oga/xml/parser/doctype_spec.rb
+++ b/spec/oga/xml/parser/doctype_spec.rb
@@ -1,106 +1,106 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'basic doctypes' do
+ describe 'basic doctypes' do
before :all do
@document = parse('')
end
- example 'return a Doctype instance' do
+ it 'returns a Doctype instance' do
@document.doctype.is_a?(Oga::XML::Doctype).should == true
end
- example 'set the name of the doctype' do
+ it 'sets the name of the doctype' do
@document.doctype.name.should == 'html'
end
end
- context 'doctypes with a type' do
+ describe 'doctypes with a type' do
before :all do
@document = parse('')
end
- example 'return a Doctype instance' do
+ it 'returns a Doctype instance' do
@document.doctype.is_a?(Oga::XML::Doctype).should == true
end
- example 'set the name of the doctype' do
+ it 'sets the name of the doctype' do
@document.doctype.name.should == 'html'
end
- example 'set the type of the doctype' do
+ it 'sets the type of the doctype' do
@document.doctype.type.should == 'PUBLIC'
end
end
- context 'doctypes with a public ID' do
+ describe 'doctypes with a public ID' do
before :all do
@document = parse('')
end
- example 'return a Doctype instance' do
+ it 'returns a Doctype instance' do
@document.doctype.is_a?(Oga::XML::Doctype).should == true
end
- example 'set the name of the doctype' do
+ it 'sets the name of the doctype' do
@document.doctype.name.should == 'html'
end
- example 'set the type of the doctype' do
+ it 'sets the type of the doctype' do
@document.doctype.type.should == 'PUBLIC'
end
- example 'set the public ID of the doctype' do
+ it 'sets the public ID of the doctype' do
@document.doctype.public_id.should == 'foo'
end
end
- context 'doctypes with a system ID' do
+ describe 'doctypes with a system ID' do
before :all do
@document = parse('')
end
- example 'return a Doctype instance' do
+ it 'returns a Doctype instance' do
@document.doctype.is_a?(Oga::XML::Doctype).should == true
end
- example 'set the name of the doctype' do
+ it 'sets the name of the doctype' do
@document.doctype.name.should == 'html'
end
- example 'set the type of the doctype' do
+ it 'sets the type of the doctype' do
@document.doctype.type.should == 'PUBLIC'
end
- example 'set the public ID of the doctype' do
+ it 'sets the public ID of the doctype' do
@document.doctype.public_id.should == 'foo'
end
- example 'set the system ID of the doctype' do
+ it 'sets the system ID of the doctype' do
@document.doctype.system_id.should == 'bar'
end
end
- context 'doctypes with inline rules' do
+ describe 'doctypes with inline rules' do
before :all do
@document = parse(']>')
end
- example 'return a Doctype instance' do
+ it 'returns a Doctype instance' do
@document.doctype.is_a?(Oga::XML::Doctype).should == true
end
- example 'set the inline doctype rules' do
+ it 'sets the inline doctype rules' do
@document.doctype.inline_rules.should == ''
end
end
- context 'doctypes with inline rules and newlines using a StringIO' do
+ describe 'doctypes with inline rules and newlines using a StringIO' do
before :all do
@document = parse(StringIO.new(""))
end
- example 'set the inline doctype rules' do
+ it 'sets the inline doctype rules' do
@document.doctype.inline_rules.should == "\nfoo"
end
end
diff --git a/spec/oga/xml/parser/documents_spec.rb b/spec/oga/xml/parser/documents_spec.rb
index 4479233..d12a1a2 100644
--- a/spec/oga/xml/parser/documents_spec.rb
+++ b/spec/oga/xml/parser/documents_spec.rb
@@ -1,31 +1,31 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'empty documents' do
+ describe 'empty documents' do
before :all do
@document = parse('')
end
- example 'return a Document instance' do
+ it 'returns a Document instance' do
@document.is_a?(Oga::XML::Document).should == true
end
end
- context 'XML documents' do
+ describe 'XML documents' do
before :all do
@document = parse('')
end
- example 'return a Document instance' do
+ it 'returns a Document instance' do
@document.is_a?(Oga::XML::Document).should == true
end
- example 'set the document type' do
+ it 'sets the document type' do
@document.type.should == :xml
end
end
- context 'HTML documents' do
+ describe 'HTML documents' do
before :all do
html = <<-EOF.strip
@@ -41,23 +41,23 @@ describe Oga::XML::Parser do
@document = parse(html, :html => true)
end
- example 'return a Document instance' do
+ it 'returns a Document instance' do
@document.is_a?(Oga::XML::Document).should == true
end
- example 'set the document type' do
+ it 'sets the document type' do
@document.type.should == :html
end
- example 'set the doctype of the document' do
+ it 'sets the doctype of the document' do
@document.doctype.is_a?(Oga::XML::Doctype).should == true
end
- example 'set the XML declaration of the document' do
+ it 'sets the XML declaration of the document' do
@document.xml_declaration.is_a?(Oga::XML::XmlDeclaration).should == true
end
- example 'set the children of the document' do
+ it 'sets the children of the document' do
@document.children.empty?.should == false
end
end
diff --git a/spec/oga/xml/parser/elements_spec.rb b/spec/oga/xml/parser/elements_spec.rb
index 37ca966..95a4a77 100644
--- a/spec/oga/xml/parser/elements_spec.rb
+++ b/spec/oga/xml/parser/elements_spec.rb
@@ -1,43 +1,43 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'empty elements' do
+ describe 'empty elements' do
before :all do
@element = parse('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@element.is_a?(Oga::XML::Element).should == true
end
- example 'set the name of the element' do
+ it 'sets the name of the element' do
@element.name.should == 'p'
end
- example 'do not set a namespace' do
+ it 'does not set a namespace' do
@element.namespace.should be_nil
end
end
- context 'elements with namespaces' do
+ describe 'elements with namespaces' do
before :all do
@element = parse('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@element.is_a?(Oga::XML::Element).should == true
end
- example 'set the name of the element' do
+ it 'sets the name of the element' do
@element.name.should == 'p'
end
- example 'set the namespace of the element' do
+ it 'sets the namespace of the element' do
@element.namespace.name.should == 'foo'
end
end
- context 'elements with default namespaces' do
+ describe 'elements with default namespaces' do
before :all do
@document = parse('')
@@ -45,124 +45,124 @@ describe Oga::XML::Parser do
@bar = @foo.children[0]
end
- example 'set the namespace name of the element' do
+ it 'sets the namespace name of the element' do
@foo.namespace.name.should == 'xmlns'
end
- example 'set the namespace URI of the element' do
+ it 'sets the namespace URI of the element' do
@foo.namespace.uri.should == 'bar'
end
- example 'set the namespace name of the element' do
+ it 'sets the namespace name of the element' do
@bar.namespace.name.should == 'xmlns'
end
- example 'set the namespace URI of the element' do
+ it 'sets the namespace URI of the element' do
@bar.namespace.uri.should == 'bar'
end
end
- context 'elements with attributes' do
+ describe 'elements with attributes' do
before :all do
@element = parse('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@element.is_a?(Oga::XML::Element).should == true
end
- example 'set the bar attribute' do
+ it 'sets the bar attribute' do
@element.attribute('bar').value.should == 'baz'
end
- example 'do not set the attribute namespace' do
+ it 'does not set the attribute namespace' do
@element.attribute('bar').namespace.should be_nil
end
end
- context 'elements with attributes without values' do
+ describe 'elements with attributes without values' do
before :all do
@element = parse('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@element.is_a?(Oga::XML::Element).should == true
end
- example 'set the bar attribute' do
+ it 'sets the bar attribute' do
@element.attribute('bar').value.should be_nil
end
end
- context 'elements with attributes with empty values' do
+ describe 'elements with attributes with empty values' do
before :all do
@element = parse('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@element.is_a?(Oga::XML::Element).should == true
end
- example 'set the bar attribute' do
+ it 'sets the bar attribute' do
@element.attribute('bar').value.should == ''
end
end
- context 'elements with namespaced attributes' do
+ describe 'elements with namespaced attributes' do
before :all do
@element = parse('').children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@element.is_a?(Oga::XML::Element).should == true
end
- example 'include the namespace of the attribute' do
+ it 'includes the namespace of the attribute' do
@element.attribute('x:bar').namespace.name.should == 'x'
end
- example 'include the name of the attribute' do
+ it 'includes the name of the attribute' do
@element.attribute('x:bar').name.should == 'bar'
end
- example 'include the value of the attribute' do
+ it 'includes the value of the attribute' do
@element.attribute('x:bar').value.should == 'baz'
end
end
- context 'elements with child elements' do
+ describe 'elements with child elements' do
before :all do
@element = parse('').children[0]
end
- example 'set the name of the outer element' do
+ it 'sets the name of the outer element' do
@element.name.should == 'a'
end
- example 'set the child elements' do
+ it 'sets the child elements' do
@element.children[0].is_a?(Oga::XML::Element).should == true
end
- example 'set the name of the child element' do
+ it 'sets the name of the child element' do
@element.children[0].name.should == 'b'
end
end
- context 'elements with child elements and text' do
+ describe 'elements with child elements and text' do
before :all do
@element = parse('Foobar').children[0]
end
- example 'include the text node of the outer element' do
+ it 'includes the text node of the outer element' do
@element.children[0].is_a?(Oga::XML::Text).should == true
end
- example 'include the text node of the inner element' do
+ it 'includes the text node of the inner element' do
@element.children[1].children[0].is_a?(Oga::XML::Text).should == true
end
end
- context 'elements with namespace registrations' do
+ describe 'elements with namespace registrations' do
before :all do
document = parse('')
@@ -170,21 +170,21 @@ describe Oga::XML::Parser do
@foo = @root.children[0]
end
- example 'return the namespaces of the node' do
+ it 'returns the namespaces of the node' do
@root.namespaces['a'].name.should == 'a'
@root.namespaces['a'].uri.should == '1'
end
- example 'return the namespaces of the node' do
+ it 'returns the namespaces of the node' do
@foo.namespaces['b'].name.should == 'b'
@foo.namespaces['b'].uri.should == '2'
end
- example 'return the available namespaces of the node' do
+ it 'returns the available namespaces of the node' do
@root.available_namespaces['a'].name.should == 'a'
end
- example 'return the available namespaces of the node' do
+ it 'returns the available namespaces of the node' do
@foo.available_namespaces['a'].name.should == 'a'
@foo.available_namespaces['b'].name.should == 'b'
end
diff --git a/spec/oga/xml/parser/error_spec.rb b/spec/oga/xml/parser/error_spec.rb
index adb00f2..6b9b27c 100644
--- a/spec/oga/xml/parser/error_spec.rb
+++ b/spec/oga/xml/parser/error_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'raising syntax errors' do
+ describe 'raising syntax errors' do
before do
@invalid_xml = <<-EOF.strip
@@ -12,19 +12,19 @@ describe Oga::XML::Parser do
EOF
end
- example 'raise a Racc::ParseError' do
+ it 'raises a Racc::ParseError' do
expect { parse(@invalid_xml) }.to raise_error(Racc::ParseError)
end
- example 'include the line number when using a String as input' do
+ it 'includes the line number when using a String as input' do
parse_error(@invalid_xml).should =~ /on line 5/
end
- example 'include the line number when using an IO as input' do
+ it 'includes the line number when using an IO as input' do
parse_error(StringIO.new(@invalid_xml)).should =~ /on line 5/
end
- example 'use more friendly error messages when available' do
+ it 'uses more friendly error messages when available' do
parse_error('').should =~ /Unexpected element closing tag/
end
end
diff --git a/spec/oga/xml/parser/hierarchy_spec.rb b/spec/oga/xml/parser/hierarchy_spec.rb
index 339e2ec..fa5e4e3 100644
--- a/spec/oga/xml/parser/hierarchy_spec.rb
+++ b/spec/oga/xml/parser/hierarchy_spec.rb
@@ -1,52 +1,52 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'elements with parents' do
+ describe 'elements with parents' do
before :all do
@parent = parse('').children[0]
end
- example 'return an Element instance for the parent' do
+ it 'returns an Element instance for the parent' do
@parent.children[0].parent.is_a?(Oga::XML::Element).should == true
end
- example 'set the correct parent' do
+ it 'sets the correct parent' do
@parent.children[0].parent.should == @parent
end
end
- context 'text nodes with parents' do
+ describe 'text nodes with parents' do
before :all do
@parent = parse('foo').children[0]
end
- example 'return an Element instance for the parent' do
+ it 'returns an Element instance for the parent' do
@parent.children[0].parent.is_a?(Oga::XML::Element).should == true
end
- example 'set the correct parent' do
+ it 'sets the correct parent' do
@parent.children[0].parent.should == @parent
end
end
- context 'elements with adjacent elements' do
+ describe 'elements with adjacent elements' do
before :all do
@document = parse('')
end
- example 'return an Element instance for the next element' do
+ it 'returns an Element instance for the next element' do
@document.children[0].next.is_a?(Oga::XML::Element).should == true
end
- example 'set the correct next element' do
+ it 'sets the correct next element' do
@document.children[0].next.should == @document.children[1]
end
- example 'return an Element instance for the previous element' do
+ it 'returns an Element instance for the previous element' do
@document.children[1].previous.is_a?(Oga::XML::Element).should == true
end
- example 'set the correct previous element' do
+ it 'sets the correct previous element' do
@document.children[1].previous.should == @document.children[0]
end
end
diff --git a/spec/oga/xml/parser/html_void_elements_spec.rb b/spec/oga/xml/parser/html_void_elements_spec.rb
index 24a661e..d641d12 100644
--- a/spec/oga/xml/parser/html_void_elements_spec.rb
+++ b/spec/oga/xml/parser/html_void_elements_spec.rb
@@ -1,58 +1,58 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'void elements' do
+ describe 'void elements' do
before :all do
@node = parse('', :html => true).children[0]
end
- example 'return an Element instance' do
+ it 'returns an Element instance' do
@node.is_a?(Oga::XML::Element).should == true
end
- example 'set the name of the element' do
+ it 'sets the name of the element' do
@node.name.should == 'link'
end
end
- context 'nested void elements' do
+ describe 'nested void elements' do
before :all do
@node = parse('', :html => true).children[0]
end
- example 'set the name of the outer element' do
+ it 'sets the name of the outer element' do
@node.name.should == 'head'
end
- example 'set the name of the inner element' do
+ it 'sets the name of the inner element' do
@node.children[0].name.should == 'link'
end
end
- context 'void elements with different casing' do
+ describe 'void elements with different casing' do
before :all do
@node_uc = parse_html(' ').children[0]
end
- example 'parse void elements with different casing' do
+ it 'parses void elements with different casing' do
@node_uc.is_a?(Oga::XML::Element).should == true
end
- example 'set the name of the void element to match casing' do
+ it 'sets the name of the void element to match casing' do
@node_uc.name.should == 'BR'
end
end
- context 'void elements with attributes' do
+ describe 'void elements with attributes' do
before :all do
@node = parse('', :html => true).children[0]
end
- example 'set the name of the element' do
+ it 'sets the name of the element' do
@node.name.should == 'link'
end
- example 'set the attributes' do
+ it 'sets the attributes' do
@node.attribute('href').value.should == 'foo'
end
end
diff --git a/spec/oga/xml/parser/io_spec.rb b/spec/oga/xml/parser/io_spec.rb
index fd1fa11..ec8b571 100644
--- a/spec/oga/xml/parser/io_spec.rb
+++ b/spec/oga/xml/parser/io_spec.rb
@@ -1,15 +1,15 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'IO as input' do
- example 'parse an attribute starting with a newline' do
+ describe 'IO as input' do
+ it 'parses an attribute starting with a newline' do
io = StringIO.new("")
doc = parse(io)
doc.children[0].attributes[0].value.should == "\n10"
end
- example 'parse an attribute value split in two by a newline' do
+ it 'parses an attribute value split in two by a newline' do
io = StringIO.new("")
doc = parse(io)
diff --git a/spec/oga/xml/parser/processing_instruction_spec.rb b/spec/oga/xml/parser/processing_instruction_spec.rb
index 5af06e2..32b9462 100644
--- a/spec/oga/xml/parser/processing_instruction_spec.rb
+++ b/spec/oga/xml/parser/processing_instruction_spec.rb
@@ -1,34 +1,34 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'empty processing instructions' do
+ describe 'empty processing instructions' do
before :all do
@node = parse('').children[0]
end
- example 'return a ProcessingInstruction instance' do
+ it 'returns a ProcessingInstruction instance' do
@node.is_a?(Oga::XML::ProcessingInstruction).should == true
end
- example 'set the name of the instruction' do
+ it 'sets the name of the instruction' do
@node.name.should == 'foo'
end
end
- context 'processing instructions with text' do
+ describe 'processing instructions with text' do
before :all do
@node = parse('').children[0]
end
- example 'return a ProcessingInstruction instance' do
+ it 'returns a ProcessingInstruction instance' do
@node.is_a?(Oga::XML::ProcessingInstruction).should == true
end
- example 'set the name of the instruction' do
+ it 'sets the name of the instruction' do
@node.name.should == 'foo'
end
- example 'set the text of the instruction' do
+ it 'sets the text of the instruction' do
@node.text.should == ' bar '
end
end
diff --git a/spec/oga/xml/parser/text_spec.rb b/spec/oga/xml/parser/text_spec.rb
index d114f78..93607e2 100644
--- a/spec/oga/xml/parser/text_spec.rb
+++ b/spec/oga/xml/parser/text_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'plain text' do
+ describe 'plain text' do
before :all do
@node = parse('foo').children[0]
end
- example 'return a Text instance' do
+ it 'returns a Text instance' do
@node.is_a?(Oga::XML::Text).should == true
end
- example 'set the text' do
+ it 'sets the text' do
@node.text.should == 'foo'
end
end
diff --git a/spec/oga/xml/parser/xml_declaration_spec.rb b/spec/oga/xml/parser/xml_declaration_spec.rb
index 7a72179..38c13fb 100644
--- a/spec/oga/xml/parser/xml_declaration_spec.rb
+++ b/spec/oga/xml/parser/xml_declaration_spec.rb
@@ -1,38 +1,38 @@
require 'spec_helper'
describe Oga::XML::Parser do
- context 'empty XML declaration tags' do
+ describe 'empty XML declaration tags' do
before :all do
@node = parse('').xml_declaration
end
- example 'return an XmlDeclaration instance' do
+ it 'returns an XmlDeclaration instance' do
@node.is_a?(Oga::XML::XmlDeclaration).should == true
end
- example 'set the default XML version' do
+ it 'sets the default XML version' do
@node.version.should == '1.0'
end
- example 'set the default encoding' do
+ it 'sets the default encoding' do
@node.encoding.should == 'UTF-8'
end
end
- context 'XML declaration tags with custom attributes' do
+ describe 'XML declaration tags with custom attributes' do
before :all do
@node = parse('').xml_declaration
end
- example 'return an XmlDeclaration instance' do
+ it 'returns an XmlDeclaration instance' do
@node.is_a?(Oga::XML::XmlDeclaration).should == true
end
- example 'set the XML version' do
+ it 'sets the XML version' do
@node.version.should == '1.5'
end
- example 'set the encoding' do
+ it 'sets the encoding' do
@node.encoding.should == 'foo'
end
end
diff --git a/spec/oga/xml/processing_instruction_spec.rb b/spec/oga/xml/processing_instruction_spec.rb
index 51c8073..2619b61 100644
--- a/spec/oga/xml/processing_instruction_spec.rb
+++ b/spec/oga/xml/processing_instruction_spec.rb
@@ -1,26 +1,26 @@
require 'spec_helper'
describe Oga::XML::ProcessingInstruction do
- context '#initialize' do
- example 'set the name of the node' do
+ describe '#initialize' do
+ it 'sets the name of the node' do
described_class.new(:name => 'foo').name.should == 'foo'
end
- example 'set the text of the node' do
+ it 'sets the text of the node' do
described_class.new(:text => 'foo').text.should == 'foo'
end
end
- context '#to_xml' do
- example 'conver the node into XML' do
+ describe '#to_xml' do
+ it 'convers the node into XML' do
node = described_class.new(:name => 'foo', :text => ' bar ')
node.to_xml.should == ''
end
end
- context '#inspect' do
- example 'return the inspect value of the node' do
+ describe '#inspect' do
+ it 'returns the inspect value of the node' do
node = described_class.new(:name => 'foo', :text => ' bar ')
node.inspect.should == 'ProcessingInstruction(name: "foo" text: " bar ")'
diff --git a/spec/oga/xml/pull_parser/context_parsing_spec.rb b/spec/oga/xml/pull_parser/context_parsing_spec.rb
index a6414cf..e4e1a8b 100644
--- a/spec/oga/xml/pull_parser/context_parsing_spec.rb
+++ b/spec/oga/xml/pull_parser/context_parsing_spec.rb
@@ -1,26 +1,26 @@
require 'spec_helper'
describe Oga::XML::PullParser do
- context '#on' do
+ describe '#on' do
before do
@parser = Oga::XML::PullParser.new('')
@parser.stub(:node).and_return(Oga::XML::Text.new)
end
- example 'do not yield if the node types do not match' do
+ it 'does not yield if the node types do not match' do
expect { |b| @parser.on(:element, &b) }.to_not yield_control
end
- example 'yield if the node type matches and the nesting is empty' do
+ it 'yields if the node type matches and the nesting is empty' do
expect { |b| @parser.on(:text, &b) }.to yield_control
end
- example 'do not yield if the node type matches but the nesting does not' do
+ it 'does not yield if the node type matches but the nesting does not' do
expect { |b| @parser.on(:text, %w{foo}, &b) }.to_not yield_control
end
- example 'yield if the node type and the nesting matches' do
+ it 'yields if the node type and the nesting matches' do
@parser.stub(:nesting).and_return(%w{a b})
expect { |b| @parser.on(:text, %w{a b}, &b) }.to yield_control
diff --git a/spec/oga/xml/pull_parser/doctype_spec.rb b/spec/oga/xml/pull_parser/doctype_spec.rb
index 43bb99b..d986495 100644
--- a/spec/oga/xml/pull_parser/doctype_spec.rb
+++ b/spec/oga/xml/pull_parser/doctype_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::PullParser do
- context 'doctypes' do
+ describe 'doctypes' do
before :all do
@parser = described_class.new('')
end
- example 'ignore doctypes' do
+ it 'ignores doctypes' do
amount = 0
@parser.parse do
diff --git a/spec/oga/xml/pull_parser/element_nesting_spec.rb b/spec/oga/xml/pull_parser/element_nesting_spec.rb
index d08e2b2..873a17b 100644
--- a/spec/oga/xml/pull_parser/element_nesting_spec.rb
+++ b/spec/oga/xml/pull_parser/element_nesting_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::PullParser do
- context 'tracking element nesting' do
+ describe 'tracking element nesting' do
before do
@parser = described_class.new('')
end
- example 'set the nesting for the outer element' do
+ it 'sets the nesting for the outer element' do
@parser.parse do |node|
@parser.nesting.should == %w{a} if node.name == 'a'
@@ -14,7 +14,7 @@ describe Oga::XML::PullParser do
end
end
- example 'pop element names after leaving an element' do
+ it 'pops element names after leaving an element' do
@parser.nesting.should_receive(:pop).twice
@parser.parse { |node| }
diff --git a/spec/oga/xml/pull_parser/element_spec.rb b/spec/oga/xml/pull_parser/element_spec.rb
index 4b3b0c7..86541d8 100644
--- a/spec/oga/xml/pull_parser/element_spec.rb
+++ b/spec/oga/xml/pull_parser/element_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::PullParser do
- context 'elements' do
+ describe 'elements' do
before :all do
@parser = described_class.new('Alice')
end
- example 'parse an element' do
+ it 'parses an element' do
name = nil
@parser.parse do |node|
@@ -16,7 +16,7 @@ describe Oga::XML::PullParser do
name.should == 'person'
end
- example 'parse the text of an element' do
+ it 'parses the text of an element' do
text = nil
@parser.parse do |node|
diff --git a/spec/oga/xml/pull_parser/general_spec.rb b/spec/oga/xml/pull_parser/general_spec.rb
index d28fb07..94b207e 100644
--- a/spec/oga/xml/pull_parser/general_spec.rb
+++ b/spec/oga/xml/pull_parser/general_spec.rb
@@ -1,18 +1,18 @@
require 'spec_helper'
describe Oga::XML::PullParser do
- context 'tracking nodes' do
+ describe 'tracking nodes' do
before :all do
@parser = described_class.new('')
end
- example 'track the current node' do
+ it 'tracks the current node' do
@parser.parse do
@parser.node.is_a?(Oga::XML::Element).should == true
end
end
- example 'reset the current node after parsing' do
+ it 'resets the current node after parsing' do
@parser.parse { }
@parser.node.nil?.should == true
diff --git a/spec/oga/xml/pull_parser/processing_instruction_spec.rb b/spec/oga/xml/pull_parser/processing_instruction_spec.rb
index 19f6d5e..0b23d83 100644
--- a/spec/oga/xml/pull_parser/processing_instruction_spec.rb
+++ b/spec/oga/xml/pull_parser/processing_instruction_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XML::PullParser do
- context 'processing instructions' do
+ describe 'processing instructions' do
before :all do
@parser = described_class.new('')
@@ -10,15 +10,15 @@ describe Oga::XML::PullParser do
@parser.parse { |node| @node = node }
end
- example 'return a ProcessingInstruction node' do
+ it 'returns a ProcessingInstruction node' do
@node.is_a?(Oga::XML::ProcessingInstruction).should == true
end
- example 'set the name of the node' do
+ it 'sets the name of the node' do
@node.name.should == 'foo'
end
- example 'set the text of the node' do
+ it 'sets the text of the node' do
@node.text.should == ' bar '
end
end
diff --git a/spec/oga/xml/querying_spec.rb b/spec/oga/xml/querying_spec.rb
index 8e4f267..437ec72 100644
--- a/spec/oga/xml/querying_spec.rb
+++ b/spec/oga/xml/querying_spec.rb
@@ -5,42 +5,42 @@ describe Oga::XML::Querying do
@document = parse('foo')
end
- context '#xpath' do
- example 'query a document' do
+ describe '#xpath' do
+ it 'queries a document' do
@document.xpath('a')[0].name.should == 'a'
end
- example 'query an element' do
+ it 'queries an element' do
@document.children[0].xpath('text()')[0].text.should == 'foo'
end
- example 'evaluate an expression using a variable' do
+ it 'evaluates an expression using a variable' do
@document.xpath('$number', 'number' => 10).should == 10
end
end
- context '#at_xpath' do
- example 'query a document' do
+ describe '#at_xpath' do
+ it 'queries a document' do
@document.at_xpath('a').name.should == 'a'
end
- example 'query an element' do
+ it 'queries an element' do
@document.children[0].at_xpath('text()').text.should == 'foo'
end
- example 'evaluate an expression using a variable' do
+ it 'evaluates an expression using a variable' do
@document.at_xpath('$number', 'number' => 10).should == 10
end
end
- context '#css' do
- example 'query a document' do
+ describe '#css' do
+ it 'queries a document' do
@document.css('a').should == @document.children
end
end
- context '#at_css' do
- example 'query a document' do
+ describe '#at_css' do
+ it 'queries a document' do
@document.at_css('a').should == @document.children[0]
end
end
diff --git a/spec/oga/xml/sax_parser_spec.rb b/spec/oga/xml/sax_parser_spec.rb
index e91333a..a41e92e 100644
--- a/spec/oga/xml/sax_parser_spec.rb
+++ b/spec/oga/xml/sax_parser_spec.rb
@@ -16,13 +16,13 @@ describe Oga::XML::SaxParser do
end
end
- example 'ignore return values of callback methods' do
+ it 'ignores return values of callback methods' do
parser = described_class.new(@handler.new, 'foo')
parser.parse.should be_nil
end
- example 'use custom callback methods if defined' do
+ it 'uses custom callback methods if defined' do
handler = @handler.new
parser = described_class.new(handler, '')
@@ -31,7 +31,7 @@ describe Oga::XML::SaxParser do
handler.name.should == 'foo'
end
- example 'always pass element names to after_element' do
+ it 'always passes element names to after_element' do
handler = @handler.new
parser = described_class.new(handler, '')
@@ -41,7 +41,7 @@ describe Oga::XML::SaxParser do
handler.after_namespace.should == 'namespace'
end
- example 'ignore callbacks that are not defined in the handler' do
+ it 'ignores callbacks that are not defined in the handler' do
parser = described_class.new(@handler.new, '')
# This would raise if undefined callbacks were _not_ ignored.
diff --git a/spec/oga/xml/text_spec.rb b/spec/oga/xml/text_spec.rb
index 0c5ff07..d3cd76b 100644
--- a/spec/oga/xml/text_spec.rb
+++ b/spec/oga/xml/text_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::Text do
- context 'setting attributes' do
- example 'set the text via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the text via the constructor' do
described_class.new(:text => 'foo').text.should == 'foo'
end
- example 'set the text via a setter' do
+ it 'sets the text via a setter' do
instance = described_class.new
instance.text = 'foo'
@@ -14,26 +14,26 @@ describe Oga::XML::Text do
end
end
- context '#to_xml' do
- example 'generate the corresponding XML' do
+ describe '#to_xml' do
+ it 'generates the corresponding XML' do
node = described_class.new(:text => 'foo')
node.to_xml.should == 'foo'
end
- example 'encode special characters as XML entities' do
+ it 'encodes special characters as XML entities' do
node = described_class.new(:text => '&<>')
node.to_xml.should == '&<>'
end
end
- context '#inspect' do
+ describe '#inspect' do
before do
@instance = described_class.new(:text => 'foo')
end
- example 'return the inspect value' do
+ it 'returns the inspect value' do
@instance.inspect.should == 'Text("foo")'
end
end
diff --git a/spec/oga/xml/traversal_spec.rb b/spec/oga/xml/traversal_spec.rb
index 23b16c9..0ee0762 100644
--- a/spec/oga/xml/traversal_spec.rb
+++ b/spec/oga/xml/traversal_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XML::Traversal do
- context '#each_node' do
+ describe '#each_node' do
before do
@document = parse(<<-EOF.strip.gsub(/\s+/m, ''))
@@ -15,7 +15,7 @@ describe Oga::XML::Traversal do
EOF
end
- example 'yield the nodes in document order' do
+ it 'yields the nodes in document order' do
names = []
@document.each_node do |node|
@@ -25,7 +25,7 @@ describe Oga::XML::Traversal do
names.should == %w{books book1 title1 Foo book2 title2 Bar}
end
- example 'skip child nodes when skip_children is thrown' do
+ it 'skips child nodes when skip_children is thrown' do
names = []
@document.each_node do |node|
diff --git a/spec/oga/xml/xml_declaration_spec.rb b/spec/oga/xml/xml_declaration_spec.rb
index 13f2b05..ebdc802 100644
--- a/spec/oga/xml/xml_declaration_spec.rb
+++ b/spec/oga/xml/xml_declaration_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XML::XmlDeclaration do
- context 'setting attributes' do
- example 'set the version via the constructor' do
+ describe 'setting attributes' do
+ it 'sets the version via the constructor' do
described_class.new(:version => '1.0').version.should == '1.0'
end
- example 'set the version via a setter' do
+ it 'sets the version via a setter' do
instance = described_class.new
instance.version = '1.0'
@@ -14,21 +14,21 @@ describe Oga::XML::XmlDeclaration do
end
end
- context 'default attribute values' do
+ describe 'default attribute values' do
before do
@instance = described_class.new
end
- example 'set the default version' do
+ it 'sets the default version' do
@instance.version.should == '1.0'
end
- example 'set the default encoding' do
+ it 'sets the default encoding' do
@instance.encoding.should == 'UTF-8'
end
end
- context '#to_xml' do
+ describe '#to_xml' do
before do
@instance = described_class.new(
:version => '1.0',
@@ -37,18 +37,18 @@ describe Oga::XML::XmlDeclaration do
)
end
- example 'generate the corresponding XML' do
+ it 'generates the corresponding XML' do
@instance.to_xml
.should == ''
end
end
- context '#inspect' do
+ describe '#inspect' do
before do
@instance = described_class.new(:version => '1.0')
end
- example 'pretty-print the node' do
+ it 'pretty-prints the node' do
@instance.inspect.should == <<-EOF.strip
XmlDeclaration(version: "1.0" encoding: "UTF-8")
EOF
diff --git a/spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb b/spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb
index 799c538..dcc397b 100644
--- a/spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'ancestor-or-self axis' do
+ describe 'ancestor-or-self axis' do
before do
@document = parse('')
@@ -10,23 +10,23 @@ describe Oga::XPath::Evaluator do
@c1 = @b1.children[0]
end
- example 'return a node set containing the direct ancestor' do
+ it 'returns a node set containing the direct ancestor' do
evaluate_xpath(@c1, 'ancestor-or-self::b').should == node_set(@b1)
end
- example 'return a node set containing a higher ancestor' do
+ it 'returns a node set containing a higher ancestor' do
evaluate_xpath(@c1, 'ancestor-or-self::a').should == node_set(@a1)
end
- example 'return a node set containing the context node itself' do
+ it 'returns a node set containing the context node itself' do
evaluate_xpath(@c1, 'ancestor-or-self::c').should == node_set(@c1)
end
- example 'return a node set containing the first ancestor' do
+ it 'returns a node set containing the first ancestor' do
evaluate_xpath(@c1, 'ancestor-or-self::*[1]').should == node_set(@c1)
end
- example 'return an empty node set for non existing ancestors' do
+ it 'returns an empty node set for non existing ancestors' do
evaluate_xpath(@c1, 'ancestor-or-self::foo').should == node_set
end
end
diff --git a/spec/oga/xpath/evaluator/axes/ancestor_spec.rb b/spec/oga/xpath/evaluator/axes/ancestor_spec.rb
index 221155a..53aa369 100644
--- a/spec/oga/xpath/evaluator/axes/ancestor_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/ancestor_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'ancestor axis' do
+ describe 'ancestor axis' do
before do
@document = parse('')
@@ -10,19 +10,19 @@ describe Oga::XPath::Evaluator do
@c1 = @b1.children[0]
end
- example 'return a node set containing a direct ancestor' do
+ it 'returns a node set containing a direct ancestor' do
evaluate_xpath(@c1, 'ancestor::b').should == node_set(@b1)
end
- example 'return a node set containing a higher ancestor' do
+ it 'returns a node set containing a higher ancestor' do
evaluate_xpath(@c1, 'ancestor::a').should == node_set(@a1)
end
- example 'return a node set containing the first ancestor' do
+ it 'returns a node set containing the first ancestor' do
evaluate_xpath(@c1, 'ancestor::*[1]').should == node_set(@b1)
end
- example 'return an empty node set for non existing ancestors' do
+ it 'returns an empty node set for non existing ancestors' do
evaluate_xpath(@c1, 'ancestor::c').should == node_set
end
end
diff --git a/spec/oga/xpath/evaluator/axes/attribute_spec.rb b/spec/oga/xpath/evaluator/axes/attribute_spec.rb
index cc87b81..1ed1498 100644
--- a/spec/oga/xpath/evaluator/axes/attribute_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/attribute_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'attribute axis' do
+ describe 'attribute axis' do
before do
@document = parse('')
@@ -9,15 +9,15 @@ describe Oga::XPath::Evaluator do
@attr = @a1.attribute('foo')
end
- example 'return a node set containing an attribute' do
+ it 'returns a node set containing an attribute' do
evaluate_xpath(@a1, 'attribute::foo').should == node_set(@attr)
end
- example 'return a node set containing an attribute using the short form' do
+ it 'returns a node set containing an attribute using the short form' do
evaluate_xpath(@a1, '@foo').should == node_set(@attr)
end
- example 'return an empty node set for non existing attributes' do
+ it 'returns an empty node set for non existing attributes' do
evaluate_xpath(@a1, 'attribute::bar').should == node_set
end
end
diff --git a/spec/oga/xpath/evaluator/axes/child_spec.rb b/spec/oga/xpath/evaluator/axes/child_spec.rb
index b80a8c4..55b51bc 100644
--- a/spec/oga/xpath/evaluator/axes/child_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/child_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'child axis' do
+ describe 'child axis' do
before do
@document = parse('')
@@ -9,15 +9,15 @@ describe Oga::XPath::Evaluator do
@b1 = @a1.children[0]
end
- example 'return a node set containing a direct child node' do
+ it 'returns a node set containing a direct child node' do
evaluate_xpath(@document, 'child::a').should == node_set(@a1)
end
- example 'return a node set containing a nested child node' do
+ it 'returns a node set containing a nested child node' do
evaluate_xpath(@document, 'child::a/child::b').should == node_set(@b1)
end
- example 'return an empty node set for non existing child nodes' do
+ it 'returns an empty node set for non existing child nodes' do
evaluate_xpath(@document, 'child::x').should == node_set
end
end
diff --git a/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb b/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb
index 75ee621..fd89f70 100644
--- a/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'descendant-or-self axis' do
+ describe 'descendant-or-self axis' do
before do
@document = parse('')
@@ -11,58 +11,58 @@ describe Oga::XPath::Evaluator do
@c1 = @b2.children[0]
end
- example 'return a node set containing a direct descendant' do
+ it 'returns a node set containing a direct descendant' do
evaluate_xpath(@document, 'descendant-or-self::b')
.should == node_set(@b1, @b2)
end
- example 'return a node set containing a nested descendant' do
+ it 'returns a node set containing a nested descendant' do
evaluate_xpath(@document, 'descendant-or-self::c').should == node_set(@c1)
end
- example 'return a node set using multiple descendant expressions' do
+ it 'returns a node set using multiple descendant expressions' do
evaluate_xpath(@document, 'descendant-or-self::a/descendant-or-self::*')
.should == node_set(@a1, @b1, @b2, @c1)
end
- example 'return a node set containing a descendant with an attribute' do
+ it 'returns a node set containing a descendant with an attribute' do
evaluate_xpath(@document, 'descendant-or-self::c[@class="x"]')
.should == node_set(@c1)
end
- example 'return a node set containing a descendant relative to a node' do
+ it 'returns a node set containing a descendant relative to a node' do
evaluate_xpath(@document, 'a/descendant-or-self::b')
.should == node_set(@b1, @b2)
end
- example 'return a node set containing the context node' do
+ it 'returns a node set containing the context node' do
evaluate_xpath(@document, 'descendant-or-self::a')
.should == node_set(@a1)
end
- example 'return a node set containing the context node relative to a node' do
+ it 'returns a node set containing the context node relative to a node' do
evaluate_xpath(@document, 'a/b/b/c/descendant-or-self::c')
.should == node_set(@c1)
end
- example 'return a node set containing the first descendant' do
+ it 'returns a node set containing the first descendant' do
evaluate_xpath(@document, 'descendant-or-self::b[1]')
.should == node_set(@b1)
end
- example 'return an empty node set for a non existing descendant' do
+ it 'returns an empty node set for a non existing descendant' do
evaluate_xpath(@document, 'descendant-or-self::foobar').should == node_set
end
- example 'return a node set containing a descendant using the short form' do
+ it 'returns a node set containing a descendant using the short form' do
evaluate_xpath(@document, '//b').should == node_set(@b1, @b2)
end
- example 'return a node set containing a nested descendant using the short form' do
+ it 'returns a node set containing a nested descendant using the short form' do
evaluate_xpath(@document, '//a//*').should == node_set(@b1, @b2, @c1)
end
- example 'return a node set containing children of a descendant' do
+ it 'returns a node set containing children of a descendant' do
evaluate_xpath(@document, '//a/b').should == node_set(@b1)
end
end
diff --git a/spec/oga/xpath/evaluator/axes/descendant_spec.rb b/spec/oga/xpath/evaluator/axes/descendant_spec.rb
index 637fcc1..ec161f0 100644
--- a/spec/oga/xpath/evaluator/axes/descendant_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/descendant_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'descendant axis' do
+ describe 'descendant axis' do
before do
@document = parse('')
@@ -10,23 +10,23 @@ describe Oga::XPath::Evaluator do
@c1 = @a1.children[0].children[0]
end
- example 'return a node set containing a direct descendant' do
+ it 'returns a node set containing a direct descendant' do
evaluate_xpath(@document, 'descendant::a').should == node_set(@a1, @a2)
end
- example 'return a node set containing a nested descendant' do
+ it 'returns a node set containing a nested descendant' do
evaluate_xpath(@document, 'descendant::c').should == node_set(@c1)
end
- example 'return a node set containing a descendant relative to a node' do
+ it 'returns a node set containing a descendant relative to a node' do
evaluate_xpath(@document, 'a/descendant::a').should == node_set(@a2)
end
- example 'return a node set containing the first descendant' do
+ it 'returns a node set containing the first descendant' do
evaluate_xpath(@document, 'descendant::a[1]').should == node_set(@a1)
end
- example 'return an empty node set for non existing descendants' do
+ it 'returns an empty node set for non existing descendants' do
evaluate_xpath(@document, 'a/b/c/descendant::c').should == node_set
end
end
diff --git a/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb b/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb
index 0eadcce..38e161a 100644
--- a/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'following-sibling axis' do
+ describe 'following-sibling axis' do
before do
# Strip whitespace so it's easier to retrieve/compare elements.
@document = parse(<<-EOF.strip.gsub(/\s+/m, ''))
@@ -24,21 +24,21 @@ describe Oga::XPath::Evaluator do
# This should return an empty set since the document doesn't have any
# following nodes.
- example 'return an empty node set for the sibling of a document' do
+ it 'returns an empty node set for the sibling of a document' do
evaluate_xpath(@document, 'following-sibling::foo').should == node_set
end
- example 'return a node set containing the siblings of root/foo' do
+ it 'returns a node set containing the siblings of root/foo' do
evaluate_xpath(@document, 'root/foo/following-sibling::baz')
.should == node_set(@baz3)
end
- example 'return a node set containing the siblings of root/foo/bar' do
+ it 'returns a node set containing the siblings of root/foo/bar' do
evaluate_xpath(@document, 'root/foo/bar/following-sibling::baz')
.should == node_set(@baz1)
end
- example 'return a node set containing the siblings relative to root/foo/bar' do
+ it 'returns a node set containing the siblings relative to root/foo/bar' do
evaluate_xpath(@bar1, 'following-sibling::baz').should == node_set(@baz1)
end
end
diff --git a/spec/oga/xpath/evaluator/axes/following_spec.rb b/spec/oga/xpath/evaluator/axes/following_spec.rb
index 9fa623f..04701a9 100644
--- a/spec/oga/xpath/evaluator/axes/following_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/following_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'following axis' do
+ describe 'following axis' do
before do
# Strip whitespace so it's easier to retrieve/compare elements.
@document = parse(<<-EOF.strip.gsub(/\s+/m, ''))
@@ -24,21 +24,21 @@ describe Oga::XPath::Evaluator do
# This should return an empty set since the document doesn't have any
# following nodes.
- example 'return an empty node set for the sibling of a document' do
+ it 'returns an empty node set for the sibling of a document' do
evaluate_xpath(@document, 'following::foo').should == node_set
end
- example 'return a node set containing the following nodes of root/foo' do
+ it 'returns a node set containing the following nodes of root/foo' do
evaluate_xpath(@document, 'root/foo/following::baz')
.should == node_set(@baz3)
end
- example 'return a node set containing the following nodes of root/foo/bar' do
+ it 'returns a node set containing the following nodes of root/foo/bar' do
evaluate_xpath(@document, 'root/foo/bar/following::baz')
.should == node_set(@baz1, @baz2, @baz3)
end
- example 'return a node set containing the siblings relative to root/foo/bar' do
+ it 'returns a node set containing the siblings relative to root/foo/bar' do
evaluate_xpath(@bar1, 'following::baz')
.should == node_set(@baz1, @baz2, @baz3)
end
diff --git a/spec/oga/xpath/evaluator/axes/namespace_spec.rb b/spec/oga/xpath/evaluator/axes/namespace_spec.rb
index 2b167b2..da19178 100644
--- a/spec/oga/xpath/evaluator/axes/namespace_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/namespace_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'namespace axis' do
+ describe 'namespace axis' do
before do
@document = parse('')
@@ -9,20 +9,20 @@ describe Oga::XPath::Evaluator do
@ns_y = @document.children[0].children[0].namespaces['y']
end
- example 'return an empty node set for the document' do
+ it 'returns an empty node set for the document' do
evaluate_xpath(@document, 'namespace::*').should == node_set
end
- example 'return a node set containing the namespaces for root' do
+ it 'returns a node set containing the namespaces for root' do
evaluate_xpath(@document, 'root/namespace::x').should == node_set(@ns_x)
end
- example 'return a node set containing the namespaces for root/foo' do
+ it 'returns a node set containing the namespaces for root/foo' do
evaluate_xpath(@document, 'root/foo/namespace::*')
.should == node_set(@ns_y, @ns_x)
end
- example 'return a node set containing the namespaces for root using a wildcard' do
+ it 'returns a node set containing the namespaces for root using a wildcard' do
evaluate_xpath(@document, 'root/namespace::*').should == node_set(@ns_x)
end
end
diff --git a/spec/oga/xpath/evaluator/axes/parent_spec.rb b/spec/oga/xpath/evaluator/axes/parent_spec.rb
index 837a9d0..e189dcc 100644
--- a/spec/oga/xpath/evaluator/axes/parent_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/parent_spec.rb
@@ -1,22 +1,22 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'parent axis' do
+ describe 'parent axis' do
before do
@document = parse('')
@a1 = @document.children[0]
end
- example 'return an empty node set for non existing parents' do
+ it 'returns an empty node set for non existing parents' do
evaluate_xpath(@document, 'parent::a').should == node_set
end
- example 'return a node set containing parents of a node' do
+ it 'returns a node set containing parents of a node' do
evaluate_xpath(@document, 'a/b/parent::a').should == node_set(@a1)
end
- example 'return a node set containing parents of a node using the short form' do
+ it 'returns a node set containing parents of a node using the short form' do
evaluate_xpath(@document, 'a/b/..').should == node_set(@a1)
end
end
diff --git a/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb b/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb
index d86fe3e..653a8fd 100644
--- a/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'preceding-sibling axis' do
+ describe 'preceding-sibling axis' do
before do
@document = parse(<<-EOF.strip.gsub(/\s+/m, ''))
@@ -19,17 +19,17 @@ describe Oga::XPath::Evaluator do
@bar1 = @document.children[0].children[1]
end
- example 'return a node set containing preceding siblings of root/bar' do
+ it 'returns a node set containing preceding siblings of root/bar' do
evaluate_xpath(@document, 'root/bar/preceding-sibling::foo')
.should == node_set(@foo1)
end
- example 'return a node set containing preceding siblings of root/bar/baz' do
+ it 'returns a node set containing preceding siblings of root/bar/baz' do
evaluate_xpath(@document, 'root/bar/baz/preceding-sibling::foo')
.should == node_set(@foo2)
end
- example 'return a node set containing preceding siblings relative to root/bar' do
+ it 'returns a node set containing preceding siblings relative to root/bar' do
evaluate_xpath(@bar1, 'preceding-sibling::foo').should == node_set(@foo1)
end
end
diff --git a/spec/oga/xpath/evaluator/axes/preceding_spec.rb b/spec/oga/xpath/evaluator/axes/preceding_spec.rb
index 5ee0e87..b065afb 100644
--- a/spec/oga/xpath/evaluator/axes/preceding_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/preceding_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'preceding axis' do
+ describe 'preceding axis' do
before do
@document = parse(<<-EOF.strip.gsub(/\s+/m, ''))
@@ -22,17 +22,17 @@ describe Oga::XPath::Evaluator do
@baz3 = @document.children[0].children[1]
end
- example 'return a node set containing preceding nodes of root/foo/baz' do
+ it 'returns a node set containing preceding nodes of root/foo/baz' do
evaluate_xpath(@document, 'root/foo/baz/preceding::bar')
.should == node_set(@bar1)
end
- example 'return a node set containing preceding nodes for root/baz' do
+ it 'returns a node set containing preceding nodes for root/baz' do
evaluate_xpath(@document, 'root/baz/preceding::baz')
.should == node_set(@baz1, @baz2)
end
- example 'return a node set containing preceding nodes relative to root/baz' do
+ it 'returns a node set containing preceding nodes relative to root/baz' do
evaluate_xpath(@baz3, 'preceding::baz').should == node_set(@baz1, @baz2)
end
end
diff --git a/spec/oga/xpath/evaluator/axes/self_spec.rb b/spec/oga/xpath/evaluator/axes/self_spec.rb
index 3d8275d..204b191 100644
--- a/spec/oga/xpath/evaluator/axes/self_spec.rb
+++ b/spec/oga/xpath/evaluator/axes/self_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'self axis' do
+ describe 'self axis' do
before do
@document = parse('foobartest')
@@ -10,31 +10,31 @@ describe Oga::XPath::Evaluator do
@b2 = @a1.children[1]
end
- example 'return a node set containing the context node' do
+ it 'returns a node set containing the context node' do
evaluate_xpath(@document, 'a/self::a').should == node_set(@a1)
end
- example 'return an empty node set for non existing nodes' do
+ it 'returns an empty node set for non existing nodes' do
evaluate_xpath(@document, 'a/self::b').should == node_set
end
- example 'return a node set containing the context node using the short form' do
+ it 'returns a node set containing the context node using the short form' do
evaluate_xpath(@document, 'a/.').should == node_set(@a1)
end
- example 'return a node set by matching the text of a node' do
+ it 'returns a node set by matching the text of a node' do
evaluate_xpath(@document, 'a/b[. = "foo"]').should == node_set(@b1)
end
- example 'return a node set by matching the text of a path' do
+ it 'returns a node set by matching the text of a path' do
evaluate_xpath(@document, 'a/b[c/. = "test"]').should == node_set(@b2)
end
- example 'return a node set by matching the text of a nested predicate' do
+ it 'returns a node set by matching the text of a nested predicate' do
evaluate_xpath(@document, 'a/b[c[. = "test"]]').should == node_set(@b2)
end
- example 'return a node set containing the document itself' do
+ it 'returns a node set containing the document itself' do
evaluate_xpath(@document, 'self::node()').should == node_set(@document)
end
end
diff --git a/spec/oga/xpath/evaluator/calls/boolean_spec.rb b/spec/oga/xpath/evaluator/calls/boolean_spec.rb
index 6d42a83..0737368 100644
--- a/spec/oga/xpath/evaluator/calls/boolean_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/boolean_spec.rb
@@ -1,56 +1,56 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'boolean() function' do
+ describe 'boolean() function' do
before do
@document = parse('foo')
end
- example 'return true for a non empty string literal' do
+ it 'returns true for a non empty string literal' do
evaluate_xpath(@document, 'boolean("foo")').should == true
end
- example 'return false for an empty string' do
+ it 'returns false for an empty string' do
evaluate_xpath(@document, 'boolean("")').should == false
end
- example 'return true for a positive integer' do
+ it 'returns true for a positive integer' do
evaluate_xpath(@document, 'boolean(10)').should == true
end
- example 'return true for a boolean true' do
+ it 'returns true for a boolean true' do
evaluate_xpath(@document, 'boolean(true())').should == true
end
- example 'return false for a boolean false' do
+ it 'returns false for a boolean false' do
evaluate_xpath(@document, 'boolean(false())').should == false
end
- example 'return true for a positive float' do
+ it 'returns true for a positive float' do
evaluate_xpath(@document, 'boolean(10.5)').should == true
end
- example 'return true for a negative integer' do
+ it 'returns true for a negative integer' do
evaluate_xpath(@document, 'boolean(-5)').should == true
end
- example 'return true for a negative float' do
+ it 'returns true for a negative float' do
evaluate_xpath(@document, 'boolean(-5.2)').should == true
end
- example 'return false for a zero integer' do
+ it 'returns false for a zero integer' do
evaluate_xpath(@document, 'boolean(0)').should == false
end
- example 'return false for a zero float' do
+ it 'returns false for a zero float' do
evaluate_xpath(@document, 'boolean(0.0)').should == false
end
- example 'return true for a non empty node set' do
+ it 'returns true for a non empty node set' do
evaluate_xpath(@document, 'boolean(root/a)').should == true
end
- example 'return false for an empty node set' do
+ it 'returns false for an empty node set' do
evaluate_xpath(@document, 'boolean(root/b)').should == false
end
end
diff --git a/spec/oga/xpath/evaluator/calls/ceiling_spec.rb b/spec/oga/xpath/evaluator/calls/ceiling_spec.rb
index d6f0193..3eba365 100644
--- a/spec/oga/xpath/evaluator/calls/ceiling_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/ceiling_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'ceiling() function' do
+ describe 'ceiling() function' do
before do
@document = parse('10.123')
end
- example 'return the ceiling of a literal number' do
+ it 'returns the ceiling of a literal number' do
evaluate_xpath(@document, 'ceiling(10.123)').should == 11.0
end
- example 'return the ceiling of a literal string' do
+ it 'returns the ceiling of a literal string' do
evaluate_xpath(@document, 'ceiling("10.123")').should == 11.0
end
- example 'return the ceiling of a node set' do
+ it 'returns the ceiling of a node set' do
evaluate_xpath(@document, 'ceiling(root)').should == 11.0
end
- example 'return NaN for empty node sets' do
+ it 'returns NaN for empty node sets' do
evaluate_xpath(@document, 'ceiling(foo)').should be_nan
end
- example 'return NaN for an empty literal string' do
+ it 'returns NaN for an empty literal string' do
evaluate_xpath(@document, 'ceiling("")').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/calls/concat_spec.rb b/spec/oga/xpath/evaluator/calls/concat_spec.rb
index 24a3b40..0fc16e2 100644
--- a/spec/oga/xpath/evaluator/calls/concat_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/concat_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'concat() function' do
+ describe 'concat() function' do
before do
@document = parse('foobar')
end
- example 'concatenate two strings' do
+ it 'concatenates two strings' do
evaluate_xpath(@document, 'concat("foo", "bar")').should == 'foobar'
end
- example 'concatenate two integers' do
+ it 'concatenates two integers' do
evaluate_xpath(@document, 'concat(10, 20)').should == '1020'
end
- example 'concatenate two floats' do
+ it 'concatenates two floats' do
evaluate_xpath(@document, 'concat(10.5, 20.5)').should == '10.520.5'
end
- example 'concatenate two node sets' do
+ it 'concatenates two node sets' do
evaluate_xpath(@document, 'concat(root/a, root/b)').should == 'foobar'
end
- example 'concatenate a node set and a string' do
+ it 'concatenates a node set and a string' do
evaluate_xpath(@document, 'concat(root/a, "baz")').should == 'foobaz'
end
end
diff --git a/spec/oga/xpath/evaluator/calls/contains_spec.rb b/spec/oga/xpath/evaluator/calls/contains_spec.rb
index 66a5fe0..c29e135 100644
--- a/spec/oga/xpath/evaluator/calls/contains_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/contains_spec.rb
@@ -1,36 +1,36 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'contains() function' do
+ describe 'contains() function' do
before do
@document = parse('foofoobar')
end
- example 'return true if the 1st string contains the 2nd string' do
+ it 'returns true if the 1st string contains the 2nd string' do
evaluate_xpath(@document, 'contains("foobar", "oo")').should == true
end
- example "return false if the 1st string doesn't contain the 2nd string" do
+ it "returns false if the 1st string doesn't contain the 2nd string" do
evaluate_xpath(@document, 'contains("foobar", "baz")').should == false
end
- example 'return true if the 1st node set contains the 2nd string' do
+ it 'returns true if the 1st node set contains the 2nd string' do
evaluate_xpath(@document, 'contains(root/a, "oo")').should == true
end
- example 'return true if the 1st node set contains the 2nd node set' do
+ it 'returns true if the 1st node set contains the 2nd node set' do
evaluate_xpath(@document, 'contains(root/b, root/a)').should == true
end
- example "return false if the 1st node doesn't contain the 2nd node set" do
+ it "returns false if the 1st node doesn't contain the 2nd node set" do
evaluate_xpath(@document, 'contains(root/a, root/b)').should == false
end
- example 'return true if the 1st string contains the 2nd node set' do
+ it 'returns true if the 1st string contains the 2nd node set' do
evaluate_xpath(@document, 'contains("foobar", root/a)').should == true
end
- example 'return true when using two empty strings' do
+ it 'returns true when using two empty strings' do
evaluate_xpath(@document, 'contains("", "")').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/calls/count_spec.rb b/spec/oga/xpath/evaluator/calls/count_spec.rb
index 5a148c9..6c6e79c 100644
--- a/spec/oga/xpath/evaluator/calls/count_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/count_spec.rb
@@ -1,34 +1,34 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'count() function' do
+ describe 'count() function' do
before do
@document = parse('')
end
- example 'return the amount of nodes as a Float' do
+ it 'returns the amount of nodes as a Float' do
evaluate_xpath(@document, 'count(root)').is_a?(Float).should == true
end
- example 'count the amount of nodes' do
+ it 'counts the amount of nodes' do
evaluate_xpath(@document, 'count(root)').should == 1
end
- example 'count the amount of nodes' do
+ it 'counts the amount of nodes' do
evaluate_xpath(@document, 'count(root/a)').should == 2
end
- example 'count the amount of nodes' do
+ it 'counts the amount of nodes' do
evaluate_xpath(@document, 'count(root/a/b)').should == 1
end
- example 'raise ArgumentError if no arguments are given' do
+ it 'raises ArgumentError if no arguments are given' do
block = -> { evaluate_xpath(@document, 'count()') }
block.should raise_error(ArgumentError)
end
- example 'raise TypeError if the argument is not a NodeSet' do
+ it 'raises TypeError if the argument is not a NodeSet' do
block = -> { evaluate_xpath(@document, 'count(1)') }
block.should raise_error(TypeError)
diff --git a/spec/oga/xpath/evaluator/calls/false_spec.rb b/spec/oga/xpath/evaluator/calls/false_spec.rb
index 787696a..77d731d 100644
--- a/spec/oga/xpath/evaluator/calls/false_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/false_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'false() function' do
+ describe 'false() function' do
before do
@document = parse('')
end
- example 'return false' do
+ it 'returns false' do
evaluate_xpath(@document, 'false()').should == false
end
end
diff --git a/spec/oga/xpath/evaluator/calls/floor_spec.rb b/spec/oga/xpath/evaluator/calls/floor_spec.rb
index 86fa4d6..39666af 100644
--- a/spec/oga/xpath/evaluator/calls/floor_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/floor_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'floor() function' do
+ describe 'floor() function' do
before do
@document = parse('10.123')
end
- example 'return the floor of a literal number' do
+ it 'returns the floor of a literal number' do
evaluate_xpath(@document, 'floor(10.123)').should == 10.0
end
- example 'return the floor of a literal string' do
+ it 'returns the floor of a literal string' do
evaluate_xpath(@document, 'floor("10.123")').should == 10.0
end
- example 'return the floor of a node set' do
+ it 'returns the floor of a node set' do
evaluate_xpath(@document, 'floor(root)').should == 10.0
end
- example 'return NaN for empty node sets' do
+ it 'returns NaN for empty node sets' do
evaluate_xpath(@document, 'floor(foo)').should be_nan
end
- example 'return NaN for an empty literal string' do
+ it 'returns NaN for an empty literal string' do
evaluate_xpath(@document, 'floor("")').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/calls/id_spec.rb b/spec/oga/xpath/evaluator/calls/id_spec.rb
index 2834bf1..861a2dc 100644
--- a/spec/oga/xpath/evaluator/calls/id_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/id_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'id() function' do
+ describe 'id() function' do
before do
@document = parse('a1')
@@ -9,15 +9,15 @@ describe Oga::XPath::Evaluator do
@a2 = @document.children[0].children[1]
end
- example 'return a node set containing the nodes with ID "a1"' do
+ it 'returns a node set containing the nodes with ID "a1"' do
evaluate_xpath(@document, 'id("a1")').should == node_set(@a1)
end
- example 'return a node set containing the nodes with ID "a1" or "a2"' do
+ it 'returns a node set containing the nodes with ID "a1" or "a2"' do
evaluate_xpath(@document, 'id("a1 a2")').should == node_set(@a1, @a2)
end
- example 'return a node set containing the nodes with an ID based on a path' do
+ it 'returns a node set containing the nodes with an ID based on a path' do
evaluate_xpath(@document, 'id(root/a[2])').should == node_set(@a1)
end
end
diff --git a/spec/oga/xpath/evaluator/calls/lang_spec.rb b/spec/oga/xpath/evaluator/calls/lang_spec.rb
index 0474970..a187cb4 100644
--- a/spec/oga/xpath/evaluator/calls/lang_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/lang_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'lang() function' do
+ describe 'lang() function' do
before do
@document = parse('')
@@ -10,15 +10,15 @@ describe Oga::XPath::Evaluator do
@a2 = @root.children[1]
end
- example 'return a node set containing nodes with language "en"' do
+ it 'returns a node set containing nodes with language "en"' do
evaluate_xpath(@document, 'root[lang("en")]').should == node_set(@root)
end
- example 'return a node set containing the nodes with language "nl"' do
+ it 'returns a node set containing the nodes with language "nl"' do
evaluate_xpath(@document, 'root/a[lang("nl")]').should == node_set(@a2)
end
- example 'return a node set containing the nodes with an inherited language' do
+ it 'returns a node set containing the nodes with an inherited language' do
evaluate_xpath(@document, 'root/a[lang("en")]').should == node_set(@a1)
end
end
diff --git a/spec/oga/xpath/evaluator/calls/last_spec.rb b/spec/oga/xpath/evaluator/calls/last_spec.rb
index 6c311db..2f43feb 100644
--- a/spec/oga/xpath/evaluator/calls/last_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/last_spec.rb
@@ -1,14 +1,14 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'last() function' do
+ describe 'last() function' do
before do
@document = parse('foobar')
@a2 = @document.children[0].children[1]
end
- example 'return a node set containing the last node' do
+ it 'returns a node set containing the last node' do
evaluate_xpath(@document, 'root/a[last()]').should == node_set(@a2)
end
end
diff --git a/spec/oga/xpath/evaluator/calls/local_name_spec.rb b/spec/oga/xpath/evaluator/calls/local_name_spec.rb
index b25e774..9c9f7dc 100644
--- a/spec/oga/xpath/evaluator/calls/local_name_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/local_name_spec.rb
@@ -1,38 +1,38 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'local-name() function' do
+ describe 'local-name() function' do
before do
@document = parse('')
end
- example 'return the local name of the node' do
+ it 'returns the local name of the node' do
evaluate_xpath(@document, 'local-name(root/x:a)').should == 'a'
end
- example 'return the local name of the node' do
+ it 'returns the local name of the node' do
evaluate_xpath(@document, 'local-name(root/b)').should == 'b'
end
- example 'return the local name for the "num" attribute' do
+ it 'returns the local name for the "num" attribute' do
evaluate_xpath(@document, 'local-name(root/b/@x:num)').should == 'num'
end
- example 'return only the name of the first node in the set' do
+ it 'returns only the name of the first node in the set' do
evaluate_xpath(@document, 'local-name(root/*)').should == 'a'
end
- example 'return an empty string by default' do
+ it 'returns an empty string by default' do
evaluate_xpath(@document, 'local-name(foo)').should == ''
end
- example 'raise a TypeError for invalid argument types' do
+ it 'raises a TypeError for invalid argument types' do
block = -> { evaluate_xpath(@document, 'local-name("foo")') }
block.should raise_error(TypeError)
end
- example 'return a node set containing nodes with a local name' do
+ it 'returns a node set containing nodes with a local name' do
evaluate_xpath(@document, 'root/b[local-name()]')
.should == node_set(@document.children[0].children[1])
end
diff --git a/spec/oga/xpath/evaluator/calls/name_spec.rb b/spec/oga/xpath/evaluator/calls/name_spec.rb
index cf6373c..d2c13c1 100644
--- a/spec/oga/xpath/evaluator/calls/name_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/name_spec.rb
@@ -1,38 +1,38 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'name() function' do
+ describe 'name() function' do
before do
@document = parse('')
end
- example 'return the name of the node' do
+ it 'returns the name of the node' do
evaluate_xpath(@document, 'name(root/x:a)').should == 'x:a'
end
- example 'return the name of the node' do
+ it 'returns the name of the node' do
evaluate_xpath(@document, 'name(root/b)').should == 'b'
end
- example 'return the local name for the "num" attribute' do
+ it 'returns the local name for the "num" attribute' do
evaluate_xpath(@document, 'name(root/b/@x:num)').should == 'x:num'
end
- example 'return only the name of the first node in the set' do
+ it 'returns only the name of the first node in the set' do
evaluate_xpath(@document, 'name(root/*)').should == 'x:a'
end
- example 'return an empty string by default' do
+ it 'returns an empty string by default' do
evaluate_xpath(@document, 'name(foo)').should == ''
end
- example 'raise a TypeError for invalid argument types' do
+ it 'raises a TypeError for invalid argument types' do
block = -> { evaluate_xpath(@document, 'name("foo")') }
block.should raise_error(TypeError)
end
- example 'return a node set containing nodes with a name' do
+ it 'returns a node set containing nodes with a name' do
evaluate_xpath(@document, 'root/b[name()]')
.should == node_set(@document.children[0].children[1])
end
diff --git a/spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb b/spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb
index 704a579..2424dd4 100644
--- a/spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb
@@ -1,30 +1,30 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'namespace-uri() function' do
+ describe 'namespace-uri() function' do
before do
@document = parse('')
end
- example 'return the namespace URI of the node' do
+ it 'returns the namespace URI of the node' do
evaluate_xpath(@document, 'namespace-uri(root/x:a)').should == 'y'
end
- example 'return the namespace URI of the "num" attribute' do
+ it 'returns the namespace URI of the "num" attribute' do
evaluate_xpath(@document, 'namespace-uri(root/b/@x:num)').should == 'y'
end
- example 'return an empty string when there is no namespace URI' do
+ it 'returns an empty string when there is no namespace URI' do
evaluate_xpath(@document, 'namespace-uri(root/b)').should == ''
end
- example 'raise TypeError for invalid argument types' do
+ it 'raises TypeError for invalid argument types' do
block = -> { evaluate_xpath(@document, 'namespace-uri("foo")') }
block.should raise_error(TypeError)
end
- example 'return a node set containing nodes with a namespace URI' do
+ it 'returns a node set containing nodes with a namespace URI' do
evaluate_xpath(@document, 'root/*[namespace-uri()]')
.should == node_set(@document.children[0].children[0])
end
diff --git a/spec/oga/xpath/evaluator/calls/normalize_space_spec.rb b/spec/oga/xpath/evaluator/calls/normalize_space_spec.rb
index 1f78418..ed8575b 100644
--- a/spec/oga/xpath/evaluator/calls/normalize_space_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/normalize_space_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'normalize-space() function' do
+ describe 'normalize-space() function' do
before do
@document = parse(' fo o ')
end
- example 'normalize a literal string' do
+ it 'normalizes a literal string' do
evaluate_xpath(@document, 'normalize-space(" fo o ")').should == 'fo o'
end
- example 'normalize a string in a node set' do
+ it 'normalizes a string in a node set' do
evaluate_xpath(@document, 'normalize-space(root/a)').should == 'fo o'
end
- example 'normalize an integer' do
+ it 'normalizes an integer' do
evaluate_xpath(@document, 'normalize-space(10)').should == '10'
end
- example 'normalize a float' do
+ it 'normalizes a float' do
evaluate_xpath(@document, 'normalize-space(10.5)').should == '10.5'
end
- example 'return a node set containing nodes with normalized spaces' do
+ it 'returns a node set containing nodes with normalized spaces' do
evaluate_xpath(@document, 'root/a[normalize-space()]')
.should == node_set(@document.children[0].children[0])
end
diff --git a/spec/oga/xpath/evaluator/calls/not_spec.rb b/spec/oga/xpath/evaluator/calls/not_spec.rb
index 54a8775..6b56e07 100644
--- a/spec/oga/xpath/evaluator/calls/not_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/not_spec.rb
@@ -1,24 +1,24 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'not() function' do
+ describe 'not() function' do
before do
@document = parse('foo')
end
- example 'return false when the argument is a non-zero integer' do
+ it 'returns false when the argument is a non-zero integer' do
evaluate_xpath(@document, 'not(10)').should == false
end
- example 'return true when the argument is a zero integer' do
+ it 'returns true when the argument is a zero integer' do
evaluate_xpath(@document, 'not(0)').should == true
end
- example 'return false when the argument is a non-empty node set' do
+ it 'returns false when the argument is a non-empty node set' do
evaluate_xpath(@document, 'not(root)').should == false
end
- example 'return itrue when the argument is an empty node set' do
+ it 'returns itrue when the argument is an empty node set' do
evaluate_xpath(@document, 'not(foo)').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/calls/number_spec.rb b/spec/oga/xpath/evaluator/calls/number_spec.rb
index 6011b9e..de5ec89 100644
--- a/spec/oga/xpath/evaluator/calls/number_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/number_spec.rb
@@ -1,48 +1,48 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'number() function' do
+ describe 'number() function' do
before do
@document = parse('1010.5')
end
- example 'convert a literal string to a number' do
+ it 'converts a literal string to a number' do
evaluate_xpath(@document, 'number("10")').should == 10.0
end
- example 'convert a literal string with deciamsl to a number' do
+ it 'converts a literal string with deciamsl to a number' do
evaluate_xpath(@document, 'number("10.5")').should == 10.5
end
- example 'convert boolean true to a number' do
+ it 'converts boolean true to a number' do
evaluate_xpath(@document, 'number(true())').should == 1.0
end
- example 'convert boolean false to a number' do
+ it 'converts boolean false to a number' do
evaluate_xpath(@document, 'number(false())').should be_zero
end
- example 'convert a node set to a number' do
+ it 'converts a node set to a number' do
evaluate_xpath(@document, 'number(root/a)').should == 10.0
end
- example 'convert a node set with decimals to a number' do
+ it 'converts a node set with decimals to a number' do
evaluate_xpath(@document, 'number(root/b)').should == 10.5
end
- example 'convert a comment to a number' do
+ it 'converts a comment to a number' do
evaluate_xpath(@document, 'number(root/comment())').should == 10.0
end
- example 'return NaN for values that can not be converted to floats' do
+ it 'returns NaN for values that can not be converted to floats' do
evaluate_xpath(@document, 'number("a")').should be_nan
end
- example 'return NaN for empty node sets' do
+ it 'returns NaN for empty node sets' do
evaluate_xpath(@document, 'number(foo)').should be_nan
end
- example 'return NaN for empty strings' do
+ it 'returns NaN for empty strings' do
evaluate_xpath(@document, 'number("")').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/calls/position_spec.rb b/spec/oga/xpath/evaluator/calls/position_spec.rb
index 28692fc..0e4d6ba 100644
--- a/spec/oga/xpath/evaluator/calls/position_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/position_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'position() function' do
+ describe 'position() function' do
before do
@document = parse('foobar')
@@ -9,12 +9,12 @@ describe Oga::XPath::Evaluator do
@a2 = @document.children[0].children[1]
end
- example 'return a node set containing the first node' do
+ it 'returns a node set containing the first node' do
evaluate_xpath(@document, 'root/a[position() = 1]')
.should == node_set(@a1)
end
- example 'return a node set containing the second node' do
+ it 'returns a node set containing the second node' do
evaluate_xpath(@document, 'root/a[position() = 2]')
.should == node_set(@a2)
end
diff --git a/spec/oga/xpath/evaluator/calls/round_spec.rb b/spec/oga/xpath/evaluator/calls/round_spec.rb
index bafbcfd..3c1b45b 100644
--- a/spec/oga/xpath/evaluator/calls/round_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/round_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'round() function' do
+ describe 'round() function' do
before do
@document = parse('10.123')
end
- example 'return the rounded value of a literal number' do
+ it 'returns the rounded value of a literal number' do
evaluate_xpath(@document, 'round(10.123)').should == 10.0
end
- example 'return the rounded value of a literal string' do
+ it 'returns the rounded value of a literal string' do
evaluate_xpath(@document, 'round("10.123")').should == 10.0
end
- example 'return the rounded value of a node set' do
+ it 'returns the rounded value of a node set' do
evaluate_xpath(@document, 'round(root)').should == 10.0
end
- example 'return NaN for empty node sets' do
+ it 'returns NaN for empty node sets' do
evaluate_xpath(@document, 'round(foo)').should be_nan
end
- example 'return NaN for an empty literal string' do
+ it 'returns NaN for an empty literal string' do
evaluate_xpath(@document, 'round("")').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/calls/starts_with_spec.rb b/spec/oga/xpath/evaluator/calls/starts_with_spec.rb
index cb1b156..40778a8 100644
--- a/spec/oga/xpath/evaluator/calls/starts_with_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/starts_with_spec.rb
@@ -1,36 +1,36 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'starts-with() function' do
+ describe 'starts-with() function' do
before do
@document = parse('foofoobar')
end
- example 'return true if the 1st string starts with the 2nd string' do
+ it 'returns true if the 1st string starts with the 2nd string' do
evaluate_xpath(@document, 'starts-with("foobar", "foo")').should == true
end
- example "return false if the 1st string doesn't start with the 2nd string" do
+ it "returns false if the 1st string doesn't start with the 2nd string" do
evaluate_xpath(@document, 'starts-with("foobar", "baz")').should == false
end
- example 'return true if the 1st node set starts with the 2nd string' do
+ it 'returns true if the 1st node set starts with the 2nd string' do
evaluate_xpath(@document, 'starts-with(root/a, "foo")').should == true
end
- example 'return true if the 1st node set starts with the 2nd node set' do
+ it 'returns true if the 1st node set starts with the 2nd node set' do
evaluate_xpath(@document, 'starts-with(root/b, root/a)').should == true
end
- example "return false if the 1st node set doesn't start with the 2nd string" do
+ it "returns false if the 1st node set doesn't start with the 2nd string" do
evaluate_xpath(@document, 'starts-with(root/a, "baz")').should == false
end
- example 'return true if the 1st string starts with the 2nd node set' do
+ it 'returns true if the 1st string starts with the 2nd node set' do
evaluate_xpath(@document, 'starts-with("foobar", root/a)').should == true
end
- example 'return true when using two empty strings' do
+ it 'returns true when using two empty strings' do
evaluate_xpath(@document, 'starts-with("", "")').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/calls/string_length_spec.rb b/spec/oga/xpath/evaluator/calls/string_length_spec.rb
index bcb8aa4..0545fae 100644
--- a/spec/oga/xpath/evaluator/calls/string_length_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/string_length_spec.rb
@@ -1,29 +1,29 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'string-length() function' do
+ describe 'string-length() function' do
before do
@document = parse('x')
end
- example 'return the length of a literal string' do
+ it 'returns the length of a literal string' do
evaluate_xpath(@document, 'string-length("foo")').should == 3.0
end
- example 'return the length of a literal integer' do
+ it 'returns the length of a literal integer' do
evaluate_xpath(@document, 'string-length(10)').should == 2.0
end
- example 'return the length of a literal float' do
+ it 'returns the length of a literal float' do
# This includes the counting of the dot. That is, "10.5".length => 4
evaluate_xpath(@document, 'string-length(10.5)').should == 4.0
end
- example 'return the length of a string in a node set' do
+ it 'returns the length of a string in a node set' do
evaluate_xpath(@document, 'string-length(root)').should == 1.0
end
- example 'return a node set containing nodes with a specific text length' do
+ it 'returns a node set containing nodes with a specific text length' do
evaluate_xpath(@document, 'root/a[string-length() = 1]')
.should == node_set(@document.children[0].children[0])
end
diff --git a/spec/oga/xpath/evaluator/calls/string_spec.rb b/spec/oga/xpath/evaluator/calls/string_spec.rb
index ad6fb72..369bee6 100644
--- a/spec/oga/xpath/evaluator/calls/string_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/string_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'string() function' do
+ describe 'string() function' do
before do
@document = parse(<<-EOF)
@@ -13,52 +13,52 @@ describe Oga::XPath::Evaluator do
EOF
end
- example 'convert the node to a string' do
+ it 'converts the node to a string' do
evaluate_xpath(@document, 'string(root)')
.should == "\n a1\n b1\n \n foobar\n"
end
- example 'convert the node to a string' do
+ it 'converts the node to a string' do
evaluate_xpath(@document, 'string(root/a)').should == 'a1'
end
- example 'convert the node to a string' do
+ it 'converts the node to a string' do
evaluate_xpath(@document, 'string(root/b)').should == 'b1'
end
- example 'convert the "num" attribute to a string' do
+ it 'converts the "num" attribute to a string' do
evaluate_xpath(@document, 'string(root/b/@num)').should == '10'
end
- example 'convert the first node in a set to a string' do
+ it 'converts the first node in a set to a string' do
evaluate_xpath(@document, 'string(root/*)').should == 'a1'
end
- example 'convert an integer to a string' do
+ it 'converts an integer to a string' do
evaluate_xpath(@document, 'string(10)').should == '10'
end
- example 'convert a float to a string' do
+ it 'converts a float to a string' do
evaluate_xpath(@document, 'string(10.5)').should == '10.5'
end
- example 'convert a string to a string' do
+ it 'converts a string to a string' do
evaluate_xpath(@document, 'string("foo")').should == 'foo'
end
- example 'convert a comment to a string' do
+ it 'converts a comment to a string' do
evaluate_xpath(@document, 'string(root/c/comment())').should == 'foo'
end
- example 'convert a CDATA to a string' do
+ it 'converts a CDATA to a string' do
evaluate_xpath(@document, 'string(root/d/node())').should == 'foobar'
end
- example 'return an empty string by default' do
+ it 'returns an empty string by default' do
evaluate_xpath(@document, 'string(foobar)').should == ''
end
- example 'return a node set containing nodes with certain text' do
+ it 'returns a node set containing nodes with certain text' do
b = @document.children[0].children[1].next_element
evaluate_xpath(@document, 'root/b[string() = "b1"]')
diff --git a/spec/oga/xpath/evaluator/calls/substring_after_spec.rb b/spec/oga/xpath/evaluator/calls/substring_after_spec.rb
index 16c3e67..a8b9530 100644
--- a/spec/oga/xpath/evaluator/calls/substring_after_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/substring_after_spec.rb
@@ -1,29 +1,29 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'substring-after() function' do
+ describe 'substring-after() function' do
before do
@document = parse('-a-b-c')
end
- example 'return the substring of the 1st string after the 2nd string' do
+ it 'returns the substring of the 1st string after the 2nd string' do
evaluate_xpath(@document, 'substring-after("a-b-c", "-")').should == 'b-c'
end
- example 'return an empty string if the 2nd string is not present' do
+ it 'returns an empty string if the 2nd string is not present' do
evaluate_xpath(@document, 'substring-after("a-b-c", "x")').should == ''
end
- example 'return the substring of the 1st node set after the 2nd string' do
+ it 'returns the substring of the 1st node set after the 2nd string' do
evaluate_xpath(@document, 'substring-after(root/b, "-")').should == 'b-c'
end
- example 'return the substring of the 1st node set after the 2nd node set' do
+ it 'returns the substring of the 1st node set after the 2nd node set' do
evaluate_xpath(@document, 'substring-after(root/b, root/a)')
.should == 'b-c'
end
- example 'return an empty string when using two empty strings' do
+ it 'returns an empty string when using two empty strings' do
evaluate_xpath(@document, 'substring-after("", "")').should == ''
end
end
diff --git a/spec/oga/xpath/evaluator/calls/substring_before_spec.rb b/spec/oga/xpath/evaluator/calls/substring_before_spec.rb
index f075452..08021fa 100644
--- a/spec/oga/xpath/evaluator/calls/substring_before_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/substring_before_spec.rb
@@ -1,29 +1,29 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'substring-before() function' do
+ describe 'substring-before() function' do
before do
@document = parse('-a-b-c')
end
- example 'return the substring of the 1st string before the 2nd string' do
+ it 'returns the substring of the 1st string before the 2nd string' do
evaluate_xpath(@document, 'substring-before("a-b-c", "-")').should == 'a'
end
- example 'return an empty string if the 2nd string is not present' do
+ it 'returns an empty string if the 2nd string is not present' do
evaluate_xpath(@document, 'substring-before("a-b-c", "x")').should == ''
end
- example 'return the substring of the 1st node set before the 2nd string' do
+ it 'returns the substring of the 1st node set before the 2nd string' do
evaluate_xpath(@document, 'substring-before(root/b, "-")').should == 'a'
end
- example 'return the substring of the 1st node set before the 2nd node set' do
+ it 'returns the substring of the 1st node set before the 2nd node set' do
evaluate_xpath(@document, 'substring-before(root/b, root/a)')
.should == 'a'
end
- example 'return an empty string when using two empty strings' do
+ it 'returns an empty string when using two empty strings' do
evaluate_xpath(@document, 'substring-before("", "")').should == ''
end
end
diff --git a/spec/oga/xpath/evaluator/calls/substring_spec.rb b/spec/oga/xpath/evaluator/calls/substring_spec.rb
index 7792c37..e465337 100644
--- a/spec/oga/xpath/evaluator/calls/substring_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/substring_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'substring() function' do
+ describe 'substring() function' do
before do
@document = parse('foobar3')
end
- example 'return the substring of a string' do
+ it 'returns the substring of a string' do
evaluate_xpath(@document, 'substring("foo", 2)').should == 'oo'
end
- example 'return the substring of a string using a custom length' do
+ it 'returns the substring of a string using a custom length' do
evaluate_xpath(@document, 'substring("foo", 2, 1)').should == 'o'
end
- example 'return the substring of a node set' do
+ it 'returns the substring of a node set' do
evaluate_xpath(@document, 'substring(root/a, 2)').should == 'oobar'
end
- example 'return the substring of a node set with a node set as the length' do
+ it 'returns the substring of a node set with a node set as the length' do
evaluate_xpath(@document, 'substring(root/a, 1, root/b)').should == 'foo'
end
- example 'return an empty string when the source string is empty' do
+ it 'returns an empty string when the source string is empty' do
evaluate_xpath(@document, 'substring("", 1, 3)').should == ''
end
end
diff --git a/spec/oga/xpath/evaluator/calls/sum_spec.rb b/spec/oga/xpath/evaluator/calls/sum_spec.rb
index 51d0e50..47a3439 100644
--- a/spec/oga/xpath/evaluator/calls/sum_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/sum_spec.rb
@@ -1,25 +1,25 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'sum() spec' do
+ describe 'sum() spec' do
before do
@document = parse('12')
end
- example 'return the sum of the node' do
+ it 'returns the sum of the node' do
# The test of is "12", which is then converted to a number.
evaluate_xpath(@document, 'sum(root)').should == 12.0
end
- example 'return the sum of the child nodes of the node' do
+ it 'returns the sum of the child nodes of the node' do
evaluate_xpath(@document, 'sum(root/*)').should == 3.0
end
- example 'return zero by default' do
+ it 'returns zero by default' do
evaluate_xpath(@document, 'sum(foo)').should be_zero
end
- example 'raise a TypeError for non node set arguments' do
+ it 'raises a TypeError for non node set arguments' do
block = -> { evaluate_xpath(@document, 'sum("foo")') }
block.should raise_error(TypeError)
diff --git a/spec/oga/xpath/evaluator/calls/translate_spec.rb b/spec/oga/xpath/evaluator/calls/translate_spec.rb
index bdb030c..3ff6fee 100644
--- a/spec/oga/xpath/evaluator/calls/translate_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/translate_spec.rb
@@ -1,36 +1,36 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'translate() function' do
+ describe 'translate() function' do
before do
@document = parse('barabcABC')
end
- example 'translate a string using all string literals' do
+ it 'translates a string using all string literals' do
evaluate_xpath(@document, 'translate("bar", "abc", "ABC")')
.should == 'BAr'
end
- example "remove characters that don't occur in the replacement string" do
+ it "removes characters that don't occur in the replacement string" do
evaluate_xpath(@document, 'translate("-aaa-", "abc-", "ABC")')
.should == 'AAA'
end
- example 'use the first character occurence in the search string' do
+ it 'uses the first character occurence in the search string' do
evaluate_xpath(@document, 'translate("ab", "aba", "123")').should == '12'
end
- example 'ignore excess characters in the replacement string' do
+ it 'ignores excess characters in the replacement string' do
evaluate_xpath(@document, 'translate("abc", "abc", "123456")')
.should == '123'
end
- example 'translate a node set string using string literals' do
+ it 'translates a node set string using string literals' do
evaluate_xpath(@document, 'translate(root/a, "abc", "ABC")')
.should == 'BAr'
end
- example 'translate a node set string using other node set strings' do
+ it 'translates a node set string using other node set strings' do
evaluate_xpath(@document, 'translate(root/a, root/b, root/c)')
.should == 'BAr'
end
diff --git a/spec/oga/xpath/evaluator/calls/true_spec.rb b/spec/oga/xpath/evaluator/calls/true_spec.rb
index 0a04e01..b1e61b5 100644
--- a/spec/oga/xpath/evaluator/calls/true_spec.rb
+++ b/spec/oga/xpath/evaluator/calls/true_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'true() function' do
+ describe 'true() function' do
before do
@document = parse('')
end
- example 'return true' do
+ it 'returns true' do
evaluate_xpath(@document, 'true()').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/general_spec.rb b/spec/oga/xpath/evaluator/general_spec.rb
index 8609741..4ec3c90 100644
--- a/spec/oga/xpath/evaluator/general_spec.rb
+++ b/spec/oga/xpath/evaluator/general_spec.rb
@@ -6,44 +6,44 @@ describe Oga::XPath::Evaluator do
@evaluator = described_class.new(@document)
end
- context '#function_node' do
+ describe '#function_node' do
before do
@document = parse('Hello')
@context_set = @document.children
end
- example 'return the first node in the expression' do
+ it 'returns the first node in the expression' do
exp = s(:axis, 'child', s(:test, nil, 'a'))
node = @evaluator.function_node(@context_set, exp)
node.should == @context_set[0].children[0]
end
- example 'raise a TypeError if the expression did not return a node set' do
+ it 'raises a TypeError if the expression did not return a node set' do
exp = s(:call, 'false')
block = lambda { @evaluator.function_node(@context_set, exp) }
block.should raise_error(TypeError)
end
- example 'use the current context node if the expression is empty' do
+ it 'uses the current context node if the expression is empty' do
@evaluator.function_node(@context_set).should == @context_set[0]
end
end
- context '#first_node_text' do
- example 'return the text of the first node' do
+ describe '#first_node_text' do
+ it 'returns the text of the first node' do
@evaluator.first_node_text(@document.children).should == 'Hello'
end
- example 'return an empty string if the node set is empty' do
+ it 'returns an empty string if the node set is empty' do
set = Oga::XML::NodeSet.new
@evaluator.first_node_text(set).should == ''
end
end
- context '#child_nodes' do
+ describe '#child_nodes' do
before do
@children = Oga::XML::NodeSet.new([
Oga::XML::Element.new(:name => 'b'),
@@ -53,7 +53,7 @@ describe Oga::XPath::Evaluator do
@parent = Oga::XML::Element.new(:name => 'a', :children => @children)
end
- example "return a node's child nodes" do
+ it "returns a node's child nodes" do
nodes = @evaluator.child_nodes([@parent])
nodes[0].should == @children[0]
@@ -61,7 +61,7 @@ describe Oga::XPath::Evaluator do
end
end
- context '#node_matches?' do
+ describe '#node_matches?' do
before do
@name_node = Oga::XML::Element.new(:name => 'a')
@name_ns_node = Oga::XML::Element.new(:name => 'b', :namespace_name => 'x')
@@ -69,73 +69,73 @@ describe Oga::XPath::Evaluator do
@name_ns_node.register_namespace('x', 'y')
end
- example 'return true if a node is matched by its name' do
+ it 'returns true if a node is matched by its name' do
@evaluator.node_matches?(@name_node, s(:test, nil, 'a')).should == true
end
- example 'return true if a node is matched by a wildcard name' do
+ it 'returns true if a node is matched by a wildcard name' do
@evaluator.node_matches?(@name_node, s(:test, nil, '*')).should == true
end
- example 'return false if a node is not matched by its name' do
+ it 'returns false if a node is not matched by its name' do
@evaluator.node_matches?(@name_node, s(:test, nil, 'foo')).should == false
end
- example 'return true if a node is matched by its name and namespace' do
+ it 'returns true if a node is matched by its name and namespace' do
@evaluator.node_matches?(@name_ns_node, s(:test, 'x', 'b')).should == true
end
- example 'return false if a node is not matched by its namespace' do
+ it 'returns false if a node is not matched by its namespace' do
@evaluator.node_matches?(@name_ns_node, s(:test, 'y', 'b')).should == false
end
- example 'return true if a node is matched by a wildcard namespace' do
+ it 'returns true if a node is matched by a wildcard namespace' do
@evaluator.node_matches?(@name_ns_node, s(:test, '*', 'b')).should == true
end
- example 'return true if a node is matched by a full wildcard search' do
+ it 'returns true if a node is matched by a full wildcard search' do
@evaluator.node_matches?(@name_ns_node, s(:test, '*', '*')).should == true
end
- example 'return true if a node is matched without having a namespace' do
+ it 'returns true if a node is matched without having a namespace' do
@evaluator.node_matches?(@name_node, s(:test, '*', 'a')).should == true
end
- example 'return false when trying to match an XML::Text instance' do
+ it 'returns false when trying to match an XML::Text instance' do
text = Oga::XML::Text.new(:text => 'Foobar')
@evaluator.node_matches?(text, s(:test, nil, 'a')).should == false
end
- example 'return false when the node has a namespace that is not given' do
+ it 'returns false when the node has a namespace that is not given' do
@evaluator.node_matches?(@name_ns_node, s(:test, nil, 'b')).should == false
end
- example 'return true if a node with a namespace is matched using a wildcard' do
+ it 'returns true if a node with a namespace is matched using a wildcard' do
@evaluator.node_matches?(@name_ns_node, s(:test, nil, '*')).should == true
end
- example 'return true if the node type matches' do
+ it 'returns true if the node type matches' do
@evaluator.node_matches?(@name_node, s(:type_test, 'node')).should == true
end
end
- context '#type_matches?' do
+ describe '#type_matches?' do
before do
@element = Oga::XML::Element.new(:name => 'a')
@ns = Oga::XML::Namespace.new(:name => 'a')
end
- example 'return true if the type matches' do
+ it 'returns true if the type matches' do
@evaluator.type_matches?(@element, s(:type_test, 'node')).should == true
end
- example 'return false if the type does not match' do
+ it 'returns false if the type does not match' do
@evaluator.type_matches?(@ns, s(:type_test, 'node')).should == false
end
end
- context '#has_parent?' do
+ describe '#has_parent?' do
before do
@parent = Oga::XML::Element.new
@child = Oga::XML::Element.new
@@ -143,31 +143,31 @@ describe Oga::XPath::Evaluator do
set = Oga::XML::NodeSet.new([@child], @parent)
end
- example 'return true if a node has a parent node' do
+ it 'returns true if a node has a parent node' do
@evaluator.has_parent?(@child).should == true
end
- example 'return false if a node has no parent node' do
+ it 'returns false if a node has no parent node' do
@evaluator.has_parent?(@parent).should == false
end
end
- context '#to_string' do
- example 'convert a float to a string' do
+ describe '#to_string' do
+ it 'converts a float to a string' do
@evaluator.to_string(10.5).should == '10.5'
end
- example 'convert a float without decimals to a string' do
+ it 'converts a float without decimals to a string' do
@evaluator.to_string(10.0).should == '10'
end
end
- context '#to_float' do
- example 'convert a string to a float' do
+ describe '#to_float' do
+ it 'converts a string to a float' do
@evaluator.to_float('10').should == 10.0
end
- example "return NaN for values that can't be converted to floats" do
+ it "returns NaN for values that can't be converted to floats" do
@evaluator.to_float('a').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/operators/add_spec.rb b/spec/oga/xpath/evaluator/operators/add_spec.rb
index 49bef3e..ee5345a 100644
--- a/spec/oga/xpath/evaluator/operators/add_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/add_spec.rb
@@ -1,32 +1,32 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'add operator' do
+ describe 'add operator' do
before do
@document = parse('12')
end
- example 'add two numbers' do
+ it 'adds two numbers' do
evaluate_xpath(@document, '1 + 2').should == 3.0
end
- example 'add a number and a string' do
+ it 'adds a number and a string' do
evaluate_xpath(@document, '1 + "2"').should == 3.0
end
- example 'add two strings' do
+ it 'adds two strings' do
evaluate_xpath(@document, '"1" + "2"').should == 3.0
end
- example 'add a number and a node set' do
+ it 'adds a number and a node set' do
evaluate_xpath(@document, 'root/a + 2').should == 3.0
end
- example 'add two node sets' do
+ it 'adds two node sets' do
evaluate_xpath(@document, 'root/a + root/b').should == 3.0
end
- example 'return NaN when trying to add invalid values' do
+ it 'returns NaN when trying to add invalid values' do
evaluate_xpath(@document, '"" + 1').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/operators/and_spec.rb b/spec/oga/xpath/evaluator/operators/and_spec.rb
index 1030691..7feeeac 100644
--- a/spec/oga/xpath/evaluator/operators/and_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/and_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'and operator' do
+ describe 'and operator' do
before do
@document = parse('11')
end
- example 'return true if both boolean literals are true' do
+ it 'returns true if both boolean literals are true' do
evaluate_xpath(@document, 'true() and true()').should == true
end
- example 'return false if one of the boolean literals is false' do
+ it 'returns false if one of the boolean literals is false' do
evaluate_xpath(@document, 'true() and false()').should == false
end
- example 'return true if both node sets are non empty' do
+ it 'returns true if both node sets are non empty' do
evaluate_xpath(@document, 'root/a and root/b').should == true
end
- example 'false false if one of the node sets is empty' do
+ it 'returns false if one of the node sets is empty' do
evaluate_xpath(@document, 'root/a and root/c').should == false
end
- example 'skip the right expression if the left one evaluates to false' do
+ it 'skips the right expression if the left one evaluates to false' do
evaluator = described_class.new(@document)
evaluator.should_not receive(:on_call_true)
diff --git a/spec/oga/xpath/evaluator/operators/div_spec.rb b/spec/oga/xpath/evaluator/operators/div_spec.rb
index 5eede82..646aa9e 100644
--- a/spec/oga/xpath/evaluator/operators/div_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/div_spec.rb
@@ -1,32 +1,32 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'div operator' do
+ describe 'div operator' do
before do
@document = parse('12')
end
- example 'divide two numbers' do
+ it 'divides two numbers' do
evaluate_xpath(@document, '1 div 2').should == 0.5
end
- example 'divide a number and a string' do
+ it 'divides a number and a string' do
evaluate_xpath(@document, '1 div "2"').should == 0.5
end
- example 'divide two strings' do
+ it 'divides two strings' do
evaluate_xpath(@document, '"1" div "2"').should == 0.5
end
- example 'divide a number and a node set' do
+ it 'divides a number and a node set' do
evaluate_xpath(@document, 'root/a div 2').should == 0.5
end
- example 'divide two node sets' do
+ it 'divides two node sets' do
evaluate_xpath(@document, 'root/a div root/b').should == 0.5
end
- example 'return NaN when trying to divide invalid values' do
+ it 'returns NaN when trying to divide invalid values' do
evaluate_xpath(@document, '"" div 1').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/operators/eq_spec.rb b/spec/oga/xpath/evaluator/operators/eq_spec.rb
index e66e14c..059294b 100644
--- a/spec/oga/xpath/evaluator/operators/eq_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/eq_spec.rb
@@ -1,60 +1,60 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'equal operator' do
+ describe 'equal operator' do
before do
@document = parse('1010')
end
- example 'return true if two numbers are equal' do
+ it 'returns true if two numbers are equal' do
evaluate_xpath(@document, '10 = 10').should == true
end
- example 'return false if two numbers are not equal' do
+ it 'returns false if two numbers are not equal' do
evaluate_xpath(@document, '10 = 15').should == false
end
- example 'return true if a number and a string are equal' do
+ it 'returns true if a number and a string are equal' do
evaluate_xpath(@document, '10 = "10"').should == true
end
- example 'return true if two strings are equal' do
+ it 'returns true if two strings are equal' do
evaluate_xpath(@document, '"10" = "10"').should == true
end
- example 'return true if a string and a number are equal' do
+ it 'returns true if a string and a number are equal' do
evaluate_xpath(@document, '"10" = 10').should == true
end
- example 'return false if two strings are not equal' do
+ it 'returns false if two strings are not equal' do
evaluate_xpath(@document, '"a" = "b"').should == false
end
- example 'return true if two node sets are equal' do
+ it 'returns true if two node sets are equal' do
evaluate_xpath(@document, 'root/a = root/b').should == true
end
- example 'return false if two node sets are not equal' do
+ it 'returns false if two node sets are not equal' do
evaluate_xpath(@document, 'root/a = root/c').should == false
end
- example 'return true if a node set and a number are equal' do
+ it 'returns true if a node set and a number are equal' do
evaluate_xpath(@document, 'root/a = 10').should == true
end
- example 'return true if a node set and a string are equal' do
+ it 'returns true if a node set and a string are equal' do
evaluate_xpath(@document, 'root/a = "10"').should == true
end
- example 'return true if a node set wildcard and a number are equal' do
+ it 'returns true if a node set wildcard and a number are equal' do
evaluate_xpath(@document, 'root/* = 10').should == true
end
- example 'return true if a number and a node set wildcard are equal' do
+ it 'returns true if a number and a node set wildcard are equal' do
evaluate_xpath(@document, '10 = root/*').should == true
end
- example 'return true if an attribute and string are equal' do
+ it 'returns true if an attribute and string are equal' do
evaluate_xpath(@document, 'root/b/@class = "foo"').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/operators/gt_spec.rb b/spec/oga/xpath/evaluator/operators/gt_spec.rb
index 4ea02bb..0bbd544 100644
--- a/spec/oga/xpath/evaluator/operators/gt_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/gt_spec.rb
@@ -1,40 +1,40 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'greater-than operator' do
+ describe 'greater-than operator' do
before do
@document = parse('1020')
end
- example 'return true if a number is greater than another number' do
+ it 'returns true if a number is greater than another number' do
evaluate_xpath(@document, '20 > 10').should == true
end
- example 'return false if a number is not greater than another number' do
+ it 'returns false if a number is not greater than another number' do
evaluate_xpath(@document, '10 > 20').should == false
end
- example 'return true if a number is greater than a string' do
+ it 'returns true if a number is greater than a string' do
evaluate_xpath(@document, '20 > "10"').should == true
end
- example 'return true if a string is greater than a number' do
+ it 'returns true if a string is greater than a number' do
evaluate_xpath(@document, '"20" > 10').should == true
end
- example 'return true if a string is greater than another string' do
+ it 'returns true if a string is greater than another string' do
evaluate_xpath(@document, '"20" > "10"').should == true
end
- example 'return true if a number is greater than a node set' do
+ it 'returns true if a number is greater than a node set' do
evaluate_xpath(@document, '20 > root/a').should == true
end
- example 'return true if a string is greater than a node set' do
+ it 'returns true if a string is greater than a node set' do
evaluate_xpath(@document, '"20" > root/a').should == true
end
- example 'return true if a node set is greater than another node set' do
+ it 'returns true if a node set is greater than another node set' do
evaluate_xpath(@document, 'root/b > root/a').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/operators/gte_spec.rb b/spec/oga/xpath/evaluator/operators/gte_spec.rb
index a3278fe..17e14b7 100644
--- a/spec/oga/xpath/evaluator/operators/gte_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/gte_spec.rb
@@ -1,64 +1,64 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'greater-than-or-equal operator' do
+ describe 'greater-than-or-equal operator' do
before do
@document = parse('1020')
end
- example 'return true if a number is greater than another number' do
+ it 'returns true if a number is greater than another number' do
evaluate_xpath(@document, '20 >= 10').should == true
end
- example 'return true if a number is equal to another number' do
+ it 'returns true if a number is equal to another number' do
evaluate_xpath(@document, '10 >= 10').should == true
end
- example 'return false if a number is not greater than/equal to another number' do
+ it 'returns false if a number is not greater than/equal to another number' do
evaluate_xpath(@document, '10 >= 20').should == false
end
- example 'return true if a number is greater than a string' do
+ it 'returns true if a number is greater than a string' do
evaluate_xpath(@document, '20 >= "10"').should == true
end
- example 'return true if a number is equal to a string' do
+ it 'returns true if a number is equal to a string' do
evaluate_xpath(@document, '10 >= "10"').should == true
end
- example 'return true if a string is greater than a number' do
+ it 'returns true if a string is greater than a number' do
evaluate_xpath(@document, '"20" >= 10').should == true
end
- example 'return true if a string is equal to a number' do
+ it 'returns true if a string is equal to a number' do
evaluate_xpath(@document, '"10" >= 10').should == true
end
- example 'return true if a string is greater than another string' do
+ it 'returns true if a string is greater than another string' do
evaluate_xpath(@document, '"20" >= "10"').should == true
end
- example 'return true if a number is greater than a node set' do
+ it 'returns true if a number is greater than a node set' do
evaluate_xpath(@document, '20 >= root/a').should == true
end
- example 'return true if a number is equal to a node set' do
+ it 'returns true if a number is equal to a node set' do
evaluate_xpath(@document, '20 >= root/b').should == true
end
- example 'return true if a string is greater than a node set' do
+ it 'returns true if a string is greater than a node set' do
evaluate_xpath(@document, '"20" >= root/a').should == true
end
- example 'return true if a string is equal to a node set' do
+ it 'returns true if a string is equal to a node set' do
evaluate_xpath(@document, '"10" >= root/a').should == true
end
- example 'return true if a node set is greater than another node set' do
+ it 'returns true if a node set is greater than another node set' do
evaluate_xpath(@document, 'root/b >= root/a').should == true
end
- example 'return true if a node set is equal to another node set' do
+ it 'returns true if a node set is equal to another node set' do
evaluate_xpath(@document, 'root/b >= root/b').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/operators/lt_spec.rb b/spec/oga/xpath/evaluator/operators/lt_spec.rb
index 210b4ba..d3c7210 100644
--- a/spec/oga/xpath/evaluator/operators/lt_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/lt_spec.rb
@@ -1,40 +1,40 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'lower-than operator' do
+ describe 'lower-than operator' do
before do
@document = parse('1020')
end
- example 'return true if a number is lower than another number' do
+ it 'returns true if a number is lower than another number' do
evaluate_xpath(@document, '10 < 20').should == true
end
- example 'return false if a number is not lower than another number' do
+ it 'returns false if a number is not lower than another number' do
evaluate_xpath(@document, '20 < 10').should == false
end
- example 'return true if a number is lower than a string' do
+ it 'returns true if a number is lower than a string' do
evaluate_xpath(@document, '10 < "20"').should == true
end
- example 'return true if a string is lower than a number' do
+ it 'returns true if a string is lower than a number' do
evaluate_xpath(@document, '"10" < 20').should == true
end
- example 'return true if a string is lower than another string' do
+ it 'returns true if a string is lower than another string' do
evaluate_xpath(@document, '"10" < "20"').should == true
end
- example 'return true if a number is lower than a node set' do
+ it 'returns true if a number is lower than a node set' do
evaluate_xpath(@document, '10 < root/b').should == true
end
- example 'return true if a string is lower than a node set' do
+ it 'returns true if a string is lower than a node set' do
evaluate_xpath(@document, '"10" < root/b').should == true
end
- example 'return true if a node set is lower than another node set' do
+ it 'returns true if a node set is lower than another node set' do
evaluate_xpath(@document, 'root/a < root/b').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/operators/lte_spec.rb b/spec/oga/xpath/evaluator/operators/lte_spec.rb
index e598a95..a7f8017 100644
--- a/spec/oga/xpath/evaluator/operators/lte_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/lte_spec.rb
@@ -1,64 +1,64 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'lower-than-or-equal operator' do
+ describe 'lower-than-or-equal operator' do
before do
@document = parse('1020')
end
- example 'return true if a number is lower than another number' do
+ it 'returns true if a number is lower than another number' do
evaluate_xpath(@document, '10 <= 20').should == true
end
- example 'return true if a number is equal to another number' do
+ it 'returns true if a number is equal to another number' do
evaluate_xpath(@document, '10 <= 10').should == true
end
- example 'return false if a number is not lower than/equal to another number' do
+ it 'returns false if a number is not lower than/equal to another number' do
evaluate_xpath(@document, '20 <= 10').should == false
end
- example 'return true if a number is lower than a string' do
+ it 'returns true if a number is lower than a string' do
evaluate_xpath(@document, '10 <= "20"').should == true
end
- example 'return true if a number is equal to a string' do
+ it 'returns true if a number is equal to a string' do
evaluate_xpath(@document, '10 <= "10"').should == true
end
- example 'return true if a string is lower than a number' do
+ it 'returns true if a string is lower than a number' do
evaluate_xpath(@document, '"10" <= 20').should == true
end
- example 'return true if a string is equal to a number' do
+ it 'returns true if a string is equal to a number' do
evaluate_xpath(@document, '"10" <= 10').should == true
end
- example 'return true if a string is lower than another string' do
+ it 'returns true if a string is lower than another string' do
evaluate_xpath(@document, '"10" <= "20"').should == true
end
- example 'return true if a number is lower than a node set' do
+ it 'returns true if a number is lower than a node set' do
evaluate_xpath(@document, '10 <= root/b').should == true
end
- example 'return true if a number is equal to a node set' do
+ it 'returns true if a number is equal to a node set' do
evaluate_xpath(@document, '10 <= root/a').should == true
end
- example 'return true if a string is lower than a node set' do
+ it 'returns true if a string is lower than a node set' do
evaluate_xpath(@document, '"10" <= root/b').should == true
end
- example 'return true if a string is equal to a node set' do
+ it 'returns true if a string is equal to a node set' do
evaluate_xpath(@document, '"10" <= root/a').should == true
end
- example 'return true if a node set is lower than another node set' do
+ it 'returns true if a node set is lower than another node set' do
evaluate_xpath(@document, 'root/a <= root/b').should == true
end
- example 'return true if a node set is equal to another node set' do
+ it 'returns true if a node set is equal to another node set' do
evaluate_xpath(@document, 'root/b <= root/b').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/operators/mod_spec.rb b/spec/oga/xpath/evaluator/operators/mod_spec.rb
index d8c7fc0..5c69959 100644
--- a/spec/oga/xpath/evaluator/operators/mod_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/mod_spec.rb
@@ -1,32 +1,32 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'mod operator' do
+ describe 'mod operator' do
before do
@document = parse('23')
end
- example 'return the modulo of two numbers' do
+ it 'returns the modulo of two numbers' do
evaluate_xpath(@document, '2 mod 3').should == 2.0
end
- example 'return the modulo of a number and a string' do
+ it 'returns the modulo of a number and a string' do
evaluate_xpath(@document, '2 mod "3"').should == 2.0
end
- example 'return the modulo of two strings' do
+ it 'returns the modulo of two strings' do
evaluate_xpath(@document, '"2" mod "3"').should == 2.0
end
- example 'return the modulo of a node set and a number' do
+ it 'returns the modulo of a node set and a number' do
evaluate_xpath(@document, 'root/a mod 3').should == 2.0
end
- example 'return the modulo of two node sets' do
+ it 'returns the modulo of two node sets' do
evaluate_xpath(@document, 'root/a mod root/b').should == 2.0
end
- example 'return NaN when trying to get the modulo of invalid values' do
+ it 'returns NaN when trying to get the modulo of invalid values' do
evaluate_xpath(@document, '"" mod 1').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/operators/mul_spec.rb b/spec/oga/xpath/evaluator/operators/mul_spec.rb
index b29e960..4354a39 100644
--- a/spec/oga/xpath/evaluator/operators/mul_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/mul_spec.rb
@@ -1,32 +1,32 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'multiplication operator' do
+ describe 'multiplication operator' do
before do
@document = parse('23')
end
- example 'multiply two numbers' do
+ it 'multiplies two numbers' do
evaluate_xpath(@document, '2 * 3').should == 6.0
end
- example 'multiply a number and a string' do
+ it 'multiplies a number and a string' do
evaluate_xpath(@document, '2 * "3"').should == 6.0
end
- example 'multiply two strings' do
+ it 'multiplies two strings' do
evaluate_xpath(@document, '"2" * "3"').should == 6.0
end
- example 'multiply a node set and a number' do
+ it 'multiplies a node set and a number' do
evaluate_xpath(@document, 'root/a * 3').should == 6.0
end
- example 'multiply two node sets' do
+ it 'multiplies two node sets' do
evaluate_xpath(@document, 'root/a * root/b').should == 6.0
end
- example 'return NaN when trying to multiply invalid values' do
+ it 'returns NaN when trying to multiply invalid values' do
evaluate_xpath(@document, '"" * 1').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/operators/neq_spec.rb b/spec/oga/xpath/evaluator/operators/neq_spec.rb
index d406ef0..07a6222 100644
--- a/spec/oga/xpath/evaluator/operators/neq_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/neq_spec.rb
@@ -1,48 +1,48 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'not-equal operator' do
+ describe 'not-equal operator' do
before do
@document = parse('1010')
end
- example 'return true if two numbers are not equal' do
+ it 'returns true if two numbers are not equal' do
evaluate_xpath(@document, '10 != 20').should == true
end
- example 'return false if two numbers are equal' do
+ it 'returns false if two numbers are equal' do
evaluate_xpath(@document, '10 != 10').should == false
end
- example 'return true if a number and a string are not equal' do
+ it 'returns true if a number and a string are not equal' do
evaluate_xpath(@document, '10 != "20"').should == true
end
- example 'return true if two strings are not equal' do
+ it 'returns true if two strings are not equal' do
evaluate_xpath(@document, '"10" != "20"').should == true
end
- example 'return true if a string and a number are not equal' do
+ it 'returns true if a string and a number are not equal' do
evaluate_xpath(@document, '"10" != 20').should == true
end
- example 'return false if two strings are equal' do
+ it 'returns false if two strings are equal' do
evaluate_xpath(@document, '"a" != "a"').should == false
end
- example 'return true if two node sets are not equal' do
+ it 'returns true if two node sets are not equal' do
evaluate_xpath(@document, 'root != root/b').should == true
end
- example 'return false if two node sets are equal' do
+ it 'returns false if two node sets are equal' do
evaluate_xpath(@document, 'root/a != root/b').should == false
end
- example 'return true if a node set and a number are not equal' do
+ it 'returns true if a node set and a number are not equal' do
evaluate_xpath(@document, 'root/a != 20').should == true
end
- example 'return true if a node set and a string are not equal' do
+ it 'returns true if a node set and a string are not equal' do
evaluate_xpath(@document, 'root/a != "20"').should == true
end
end
diff --git a/spec/oga/xpath/evaluator/operators/or_spec.rb b/spec/oga/xpath/evaluator/operators/or_spec.rb
index fe9456f..2c5d84c 100644
--- a/spec/oga/xpath/evaluator/operators/or_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/or_spec.rb
@@ -1,36 +1,36 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'or operator' do
+ describe 'or operator' do
before do
@document = parse('11')
end
- example 'return true if both boolean literals are true' do
+ it 'returns true if both boolean literals are true' do
evaluate_xpath(@document, 'true() or true()').should == true
end
- example 'return true if one of the boolean literals is false' do
+ it 'returns true if one of the boolean literals is false' do
evaluate_xpath(@document, 'true() or false()').should == true
end
- example 'return true if the left node set is not empty' do
+ it 'returns true if the left node set is not empty' do
evaluate_xpath(@document, 'root/a or root/x').should == true
end
- example 'return true if the right node set is not empty' do
+ it 'returns true if the right node set is not empty' do
evaluate_xpath(@document, 'root/x or root/b').should == true
end
- example 'return true if both node sets are not empty' do
+ it 'returns true if both node sets are not empty' do
evaluate_xpath(@document, 'root/a or root/b').should == true
end
- example 'return false if both node sets are empty' do
+ it 'returns false if both node sets are empty' do
evaluate_xpath(@document, 'root/x or root/y').should == false
end
- example 'skip the right expression if the left one evaluates to false' do
+ it 'skips the right expression if the left one evaluates to false' do
evaluator = described_class.new(@document)
evaluator.should_not receive(:on_call_false)
diff --git a/spec/oga/xpath/evaluator/operators/pipe_spec.rb b/spec/oga/xpath/evaluator/operators/pipe_spec.rb
index 4644945..c221441 100644
--- a/spec/oga/xpath/evaluator/operators/pipe_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/pipe_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'pipe operator' do
+ describe 'pipe operator' do
before do
@document = parse('')
@@ -9,19 +9,19 @@ describe Oga::XPath::Evaluator do
@b1 = @document.children[0].children[1]
end
- example 'merge two node sets' do
+ it 'merges two node sets' do
evaluate_xpath(@document, 'root/a | root/b').should == node_set(@a1, @b1)
end
- example 'merge two sets when the left hand side is empty' do
+ it 'merges two sets when the left hand side is empty' do
evaluate_xpath(@document, 'foo | root/b').should == node_set(@b1)
end
- example 'merge two sets when the right hand side is empty' do
+ it 'merges two sets when the right hand side is empty' do
evaluate_xpath(@document, 'root/a | foo').should == node_set(@a1)
end
- example 'merge two identical sets' do
+ it 'merges two identical sets' do
evaluate_xpath(@document, 'root/a | root/a').should == node_set(@a1)
end
end
diff --git a/spec/oga/xpath/evaluator/operators/sub_spec.rb b/spec/oga/xpath/evaluator/operators/sub_spec.rb
index 5fd9ab6..ff80b38 100644
--- a/spec/oga/xpath/evaluator/operators/sub_spec.rb
+++ b/spec/oga/xpath/evaluator/operators/sub_spec.rb
@@ -1,32 +1,32 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'subtraction operator' do
+ describe 'subtraction operator' do
before do
@document = parse('23')
end
- example 'subtract two numbers' do
+ it 'subtracts two numbers' do
evaluate_xpath(@document, '2 - 3').should == -1.0
end
- example 'subtract a number and a string' do
+ it 'subtracts a number and a string' do
evaluate_xpath(@document, '2 - "3"').should == -1.0
end
- example 'subtract two strings' do
+ it 'subtracts two strings' do
evaluate_xpath(@document, '"2" - "3"').should == -1.0
end
- example 'subtract a node set and a number' do
+ it 'subtracts a node set and a number' do
evaluate_xpath(@document, 'root/a - 3').should == -1.0
end
- example 'subtract two node sets' do
+ it 'subtracts two node sets' do
evaluate_xpath(@document, 'root/a - root/b').should == -1.0
end
- example 'return NaN when trying to subtract invalid values' do
+ it 'returns NaN when trying to subtract invalid values' do
evaluate_xpath(@document, '"" - 1').should be_nan
end
end
diff --git a/spec/oga/xpath/evaluator/paths_spec.rb b/spec/oga/xpath/evaluator/paths_spec.rb
index 7b4f004..12191d2 100644
--- a/spec/oga/xpath/evaluator/paths_spec.rb
+++ b/spec/oga/xpath/evaluator/paths_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'paths' do
+ describe 'paths' do
before do
@document = parse('Foo')
@@ -10,37 +10,37 @@ describe Oga::XPath::Evaluator do
@b2 = @a1.children[2]
end
- example 'evaluate an absolute path' do
+ it 'evaluates an absolute path' do
evaluate_xpath(@document, '/a').should == node_set(@a1)
end
- example 'evaluate an absolute path relative to a sub node' do
+ it 'evaluates an absolute path relative to a sub node' do
b_node = @document.children[0].children[0]
evaluate_xpath(b_node, '/a').should == node_set(@a1)
end
- example 'evaluate the root selector' do
+ it 'evaluates the root selector' do
evaluate_xpath(@document, '/').should == node_set(@document)
end
- example 'evaluate a relative path' do
+ it 'evaluates a relative path' do
evaluate_xpath(@document, 'a').should == node_set(@a1)
end
- example 'evaluate a relative path that returns an empty node set' do
+ it 'evaluates a relative path that returns an empty node set' do
evaluate_xpath(@document, 'x/a').should == node_set
end
- example 'evaluate a nested absolute path' do
+ it 'evaluates a nested absolute path' do
evaluate_xpath(@document, '/a/b').should == node_set(@b1, @b2)
end
- example 'evaluate an absolute path that returns an empty node set' do
+ it 'evaluates an absolute path that returns an empty node set' do
evaluate_xpath(@document, '/x/a').should == node_set
end
- example 'evaluate a namespaced path' do
+ it 'evaluates a namespaced path' do
evaluate_xpath(@document, 'a/ns1:c').should == node_set(@a1.children[-1])
end
end
diff --git a/spec/oga/xpath/evaluator/predicates_spec.rb b/spec/oga/xpath/evaluator/predicates_spec.rb
index 1643735..4d0cbab 100644
--- a/spec/oga/xpath/evaluator/predicates_spec.rb
+++ b/spec/oga/xpath/evaluator/predicates_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'predicates' do
+ describe 'predicates' do
before do
@document = parse(<<-EOF)
@@ -17,7 +17,7 @@ describe Oga::XPath::Evaluator do
@a2 = @document.at_xpath('root/b/a[1]')
end
- example 'return a node set containing all first nodes' do
+ it 'returns a node set containing all first nodes' do
evaluate_xpath(@document, 'descendant-or-self::node()/a[1]')
.should == node_set(@a1, @a2)
end
diff --git a/spec/oga/xpath/evaluator/type_tests/comment_spec.rb b/spec/oga/xpath/evaluator/type_tests/comment_spec.rb
index 37b0add..807f750 100644
--- a/spec/oga/xpath/evaluator/type_tests/comment_spec.rb
+++ b/spec/oga/xpath/evaluator/type_tests/comment_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'comment() tests' do
+ describe 'comment() tests' do
before do
@document = parse('')
@@ -9,11 +9,11 @@ describe Oga::XPath::Evaluator do
@comment2 = @document.children[0].children[1].children[0]
end
- example 'return a node set containing comment nodes' do
+ it 'returns a node set containing comment nodes' do
evaluate_xpath(@document, 'a/comment()').should == node_set(@comment1)
end
- example 'return a node set containing nested comments' do
+ it 'returns a node set containing nested comments' do
evaluate_xpath(@document, 'a/b/comment()').should == node_set(@comment2)
end
end
diff --git a/spec/oga/xpath/evaluator/type_tests/node_spec.rb b/spec/oga/xpath/evaluator/type_tests/node_spec.rb
index f7f5a6f..3a9f026 100644
--- a/spec/oga/xpath/evaluator/type_tests/node_spec.rb
+++ b/spec/oga/xpath/evaluator/type_tests/node_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'node() tests' do
+ describe 'node() tests' do
before do
@document = parse('foo')
@@ -11,16 +11,16 @@ describe Oga::XPath::Evaluator do
@cdata1 = @a1.children[2]
end
- example 'return a node set containing elements' do
+ it 'returns a node set containing elements' do
evaluate_xpath(@document, 'node()').should == node_set(@a1)
end
- example 'return a node set containing elements, comments and CDATA tags' do
+ it 'returns a node set containing elements, comments and CDATA tags' do
evaluate_xpath(@document, 'a/node()')
.should == node_set(@b1, @comment1, @cdata1)
end
- example 'return a node set containing text nodes' do
+ it 'returns a node set containing text nodes' do
evaluate_xpath(@document, 'a/b/node()').should == node_set(@b1.children[0])
end
end
diff --git a/spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb b/spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb
index 18d9a79..4506bfe 100644
--- a/spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb
+++ b/spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'processing-instruction() tests' do
+ describe 'processing-instruction() tests' do
before do
@document = parse('')
@@ -9,12 +9,12 @@ describe Oga::XPath::Evaluator do
@proc_ins2 = @document.children[0].children[1].children[0]
end
- example 'return a node set containing processing instructions' do
+ it 'returns a node set containing processing instructions' do
evaluate_xpath(@document, 'a/processing-instruction()')
.should == node_set(@proc_ins1)
end
- example 'return a node set containing nested processing instructions' do
+ it 'returns a node set containing nested processing instructions' do
evaluate_xpath(@document, 'a/b/processing-instruction()')
.should == node_set(@proc_ins2)
end
diff --git a/spec/oga/xpath/evaluator/type_tests/text_spec.rb b/spec/oga/xpath/evaluator/type_tests/text_spec.rb
index f657855..2322c3c 100644
--- a/spec/oga/xpath/evaluator/type_tests/text_spec.rb
+++ b/spec/oga/xpath/evaluator/type_tests/text_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'text() tests' do
+ describe 'text() tests' do
before do
@document = parse('foobar')
@@ -9,11 +9,11 @@ describe Oga::XPath::Evaluator do
@text2 = @document.children[0].children[1].children[0]
end
- example 'return a node set containing text nodes' do
+ it 'returns a node set containing text nodes' do
evaluate_xpath(@document, 'a/text()').should == node_set(@text1)
end
- example 'return a node set containing nested text nodes' do
+ it 'returns a node set containing nested text nodes' do
evaluate_xpath(@document, 'a/b/text()').should == node_set(@text2)
end
end
diff --git a/spec/oga/xpath/evaluator/types/float_spec.rb b/spec/oga/xpath/evaluator/types/float_spec.rb
index e0e1f76..5718ac4 100644
--- a/spec/oga/xpath/evaluator/types/float_spec.rb
+++ b/spec/oga/xpath/evaluator/types/float_spec.rb
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'float types' do
+ describe 'float types' do
before do
@document = parse('')
end
- example 'return a float' do
+ it 'returns a float' do
evaluate_xpath(@document, '1.2').should == 1.2
end
- example 'return a negative float' do
+ it 'returns a negative float' do
evaluate_xpath(@document, '-1.2').should == -1.2
end
- example 'return floats as a Float' do
+ it 'returns floats as a Float' do
evaluate_xpath(@document, '1.2').is_a?(Float).should == true
end
end
diff --git a/spec/oga/xpath/evaluator/types/int_spec.rb b/spec/oga/xpath/evaluator/types/int_spec.rb
index cd0666b..51b36a4 100644
--- a/spec/oga/xpath/evaluator/types/int_spec.rb
+++ b/spec/oga/xpath/evaluator/types/int_spec.rb
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'integer types' do
+ describe 'integer types' do
before do
@document = parse('')
end
- example 'return an integer' do
+ it 'returns an integer' do
evaluate_xpath(@document, '1').should == 1
end
- example 'return a negative integer' do
+ it 'returns a negative integer' do
evaluate_xpath(@document, '-2').should == -2
end
- example 'return integers as a Float' do
+ it 'returns integers as a Float' do
evaluate_xpath(@document, '1').is_a?(Float).should == true
end
end
diff --git a/spec/oga/xpath/evaluator/types/string_spec.rb b/spec/oga/xpath/evaluator/types/string_spec.rb
index 5f27788..4749185 100644
--- a/spec/oga/xpath/evaluator/types/string_spec.rb
+++ b/spec/oga/xpath/evaluator/types/string_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'string types' do
+ describe 'string types' do
before do
@document = parse('')
end
- example 'return the literal string' do
+ it 'returns the literal string' do
evaluate_xpath(@document, '"foo"').should == 'foo'
end
end
diff --git a/spec/oga/xpath/evaluator/variables_spec.rb b/spec/oga/xpath/evaluator/variables_spec.rb
index d5cc80c..67825d2 100644
--- a/spec/oga/xpath/evaluator/variables_spec.rb
+++ b/spec/oga/xpath/evaluator/variables_spec.rb
@@ -1,18 +1,18 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'variable bindings' do
+ describe 'variable bindings' do
before do
@document = parse('')
end
- example 'evaluate a variable' do
+ it 'evaluates a variable' do
evaluator = described_class.new(@document, 'number' => 10.0)
evaluator.evaluate('$number').should == 10.0
end
- example 'raise RuntimeError when evaluating an unbound variable' do
+ it 'raises RuntimeError when evaluating an unbound variable' do
evaluator = described_class.new(@document)
block = lambda { evaluator.evaluate('$number') }
diff --git a/spec/oga/xpath/evaluator/wildcard_spec.rb b/spec/oga/xpath/evaluator/wildcard_spec.rb
index 8e90232..2092679 100644
--- a/spec/oga/xpath/evaluator/wildcard_spec.rb
+++ b/spec/oga/xpath/evaluator/wildcard_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Oga::XPath::Evaluator do
- context 'wildcard paths' do
+ describe 'wildcard paths' do
before do
@document = parse('')
@@ -11,19 +11,19 @@ describe Oga::XPath::Evaluator do
@c1 = @a1.children[2]
end
- example 'evaluate a wildcard path' do
+ it 'evaluates a wildcard path' do
evaluate_xpath(@document, 'a/*').should == @a1.children
end
- example 'evaluate a path using a namespace wildcard' do
+ it 'evaluates a path using a namespace wildcard' do
evaluate_xpath(@document, 'a/*:b').should == node_set(@b1, @b2)
end
- example 'evaluate a path using a namespace and a name wildcard' do
+ it 'evaluates a path using a namespace and a name wildcard' do
evaluate_xpath(@document, 'a/ns1:*').should == node_set(@c1)
end
- example 'evaluate a containing a namespace wildcard and a name wildcard' do
+ it 'evaluates a containing a namespace wildcard and a name wildcard' do
evaluate_xpath(@document, 'a/*:*').should == @a1.children
end
end
diff --git a/spec/oga/xpath/lexer/axes_spec.rb b/spec/oga/xpath/lexer/axes_spec.rb
index 30cedd8..196bfcf 100644
--- a/spec/oga/xpath/lexer/axes_spec.rb
+++ b/spec/oga/xpath/lexer/axes_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'full axes' do
- example 'lex the ancestor axis' do
+ describe 'full axes' do
+ it 'lexes the ancestor axis' do
lex_xpath('/ancestor::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'ancestor'],
@@ -10,7 +10,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the ancestor-or-self axis' do
+ it 'lexes the ancestor-or-self axis' do
lex_xpath('/ancestor-or-self::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'ancestor-or-self'],
@@ -18,7 +18,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the attribute axis' do
+ it 'lexes the attribute axis' do
lex_xpath('/attribute::class').should == [
[:T_SLASH, nil],
[:T_AXIS, 'attribute'],
@@ -26,7 +26,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the child axis' do
+ it 'lexes the child axis' do
lex_xpath('/child::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'child'],
@@ -34,7 +34,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the descendant axis' do
+ it 'lexes the descendant axis' do
lex_xpath('/descendant::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'descendant'],
@@ -42,7 +42,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the descendant-or-self axis' do
+ it 'lexes the descendant-or-self axis' do
lex_xpath('/descendant-or-self::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'descendant-or-self'],
@@ -50,7 +50,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the following axis' do
+ it 'lexes the following axis' do
lex_xpath('/following::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'following'],
@@ -58,7 +58,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the following-sibling axis' do
+ it 'lexes the following-sibling axis' do
lex_xpath('/following-sibling::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'following-sibling'],
@@ -66,7 +66,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the namespace axis' do
+ it 'lexes the namespace axis' do
lex_xpath('/namespace::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'namespace'],
@@ -74,7 +74,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the parent axis' do
+ it 'lexes the parent axis' do
lex_xpath('/parent::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'parent'],
@@ -82,7 +82,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the preceding axis' do
+ it 'lexes the preceding axis' do
lex_xpath('/preceding::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'preceding'],
@@ -90,7 +90,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the preceding-sibling axis' do
+ it 'lexes the preceding-sibling axis' do
lex_xpath('/preceding-sibling::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'preceding-sibling'],
@@ -98,7 +98,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the self axis' do
+ it 'lexes the self axis' do
lex_xpath('/self::A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'self'],
@@ -107,8 +107,8 @@ describe Oga::XPath::Lexer do
end
end
- context 'short axes' do
- example 'lex the @attribute axis' do
+ describe 'short axes' do
+ it 'lexes the @attribute axis' do
lex_xpath('/@A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'attribute'],
@@ -116,7 +116,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the // axis' do
+ it 'lexes the // axis' do
lex_xpath('//A').should == [
[:T_SLASH, nil],
[:T_AXIS, 'descendant-or-self'],
@@ -126,7 +126,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the .. axis' do
+ it 'lexes the .. axis' do
lex_xpath('/..').should == [
[:T_SLASH, nil],
[:T_AXIS, 'parent'],
@@ -134,7 +134,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the . axis' do
+ it 'lexes the . axis' do
lex_xpath('/.').should == [
[:T_SLASH, nil],
[:T_AXIS, 'self'],
@@ -142,7 +142,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex the . axis followed by a path' do
+ it 'lexes the . axis followed by a path' do
lex_xpath('./foo').should == [
[:T_AXIS, 'self'],
[:T_TYPE_TEST, 'node'],
diff --git a/spec/oga/xpath/lexer/calls_spec.rb b/spec/oga/xpath/lexer/calls_spec.rb
index bbe83cf..25e2f39 100644
--- a/spec/oga/xpath/lexer/calls_spec.rb
+++ b/spec/oga/xpath/lexer/calls_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'function calls' do
- example 'lex a function call without arguments' do
+ describe 'function calls' do
+ it 'lexes a function call without arguments' do
lex_xpath('count()').should == [
[:T_IDENT, 'count'],
[:T_LPAREN, nil],
@@ -10,7 +10,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a function call with a single argument' do
+ it 'lexes a function call with a single argument' do
lex_xpath('count(foo)').should == [
[:T_IDENT, 'count'],
[:T_LPAREN, nil],
@@ -19,7 +19,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a function call with two arguments' do
+ it 'lexes a function call with two arguments' do
lex_xpath('count(/foo, "bar")').should == [
[:T_IDENT, 'count'],
[:T_LPAREN, nil],
diff --git a/spec/oga/xpath/lexer/floats_spec.rb b/spec/oga/xpath/lexer/floats_spec.rb
index 3ff0999..d721dc0 100644
--- a/spec/oga/xpath/lexer/floats_spec.rb
+++ b/spec/oga/xpath/lexer/floats_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'floats' do
- example 'lex a float' do
+ describe 'floats' do
+ it 'lexes a float' do
lex_xpath('10.0').should == [[:T_FLOAT, 10.0]]
end
- example 'lex a negative float' do
+ it 'lexes a negative float' do
lex_xpath('-10.0').should == [[:T_FLOAT, -10.0]]
end
end
diff --git a/spec/oga/xpath/lexer/general_spec.rb b/spec/oga/xpath/lexer/general_spec.rb
index 9298b4c..2f77c82 100644
--- a/spec/oga/xpath/lexer/general_spec.rb
+++ b/spec/oga/xpath/lexer/general_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'general' do
- example 'lex a simple expression' do
+ describe 'general' do
+ it 'lexes a simple expression' do
lex_xpath('/foo').should == [[:T_SLASH, nil], [:T_IDENT, 'foo']]
end
- example 'lex a simple expression with a test starting with an underscore' do
+ it 'lexes a simple expression with a test starting with an underscore' do
lex_xpath('/_foo').should == [[:T_SLASH, nil], [:T_IDENT, '_foo']]
end
- example 'lex a node test using a namespace' do
+ it 'lexes a node test using a namespace' do
lex_xpath('/foo:bar').should == [
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
@@ -19,11 +19,11 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a whildcard node test' do
+ it 'lexes a whildcard node test' do
lex_xpath('/*').should == [[:T_SLASH, nil], [:T_IDENT, '*']]
end
- example 'lex a wildcard node test for a namespace' do
+ it 'lexes a wildcard node test for a namespace' do
lex_xpath('/*:foo').should == [
[:T_SLASH, nil],
[:T_IDENT, '*'],
@@ -35,7 +35,7 @@ describe Oga::XPath::Lexer do
# The following are a bunch of examples taken from Wikipedia and the W3
# spec to see how the lexer handles them.
- example 'lex an descendant-or-self expression' do
+ it 'lexes an descendant-or-self expression' do
lex_xpath('/wikimedia//editions').should == [
[:T_SLASH, nil],
[:T_IDENT, 'wikimedia'],
@@ -47,7 +47,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a complex expression using predicates and function calls' do
+ it 'lexes a complex expression using predicates and function calls' do
path = '/wikimedia/projects/project[@name="Wikipedia"]/editions/edition/text()'
lex_xpath(path).should == [
diff --git a/spec/oga/xpath/lexer/integers_spec.rb b/spec/oga/xpath/lexer/integers_spec.rb
index 9a6d8e0..4756f94 100644
--- a/spec/oga/xpath/lexer/integers_spec.rb
+++ b/spec/oga/xpath/lexer/integers_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'integers' do
- example 'lex an integer' do
+ describe 'integers' do
+ it 'lexes an integer' do
lex_xpath('10').should == [[:T_INT, 10]]
end
- example 'lex a negative integer' do
+ it 'lexes a negative integer' do
lex_xpath('-10').should == [[:T_INT, -10]]
end
end
diff --git a/spec/oga/xpath/lexer/node_type_spec.rb b/spec/oga/xpath/lexer/node_type_spec.rb
index 3cd76b3..6c09bd1 100644
--- a/spec/oga/xpath/lexer/node_type_spec.rb
+++ b/spec/oga/xpath/lexer/node_type_spec.rb
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'node types' do
- example 'lex the "node" type' do
+ describe 'node types' do
+ it 'lexes the "node" type' do
lex_xpath('node()').should == [[:T_TYPE_TEST, 'node']]
end
- example 'lex the "comment" type' do
+ it 'lexes the "comment" type' do
lex_xpath('comment()').should == [[:T_TYPE_TEST, 'comment']]
end
- example 'lex the "text" type' do
+ it 'lexes the "text" type' do
lex_xpath('text()').should == [[:T_TYPE_TEST, 'text']]
end
- example 'lex the "processing-instruction" type' do
+ it 'lexes the "processing-instruction" type' do
lex_xpath('processing-instruction()').should == [
[:T_TYPE_TEST, 'processing-instruction']
]
diff --git a/spec/oga/xpath/lexer/operators_spec.rb b/spec/oga/xpath/lexer/operators_spec.rb
index 3d58d18..f7fcdc3 100644
--- a/spec/oga/xpath/lexer/operators_spec.rb
+++ b/spec/oga/xpath/lexer/operators_spec.rb
@@ -1,60 +1,60 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'operators' do
- example 'lex the pipe operator' do
+ describe 'operators' do
+ it 'lexes the pipe operator' do
lex_xpath('|').should == [[:T_PIPE, nil]]
end
- example 'lex the and operator' do
+ it 'lexes the and operator' do
lex_xpath(' and ').should == [[:T_AND, nil]]
end
- example 'lex the or operator' do
+ it 'lexes the or operator' do
lex_xpath(' or ').should == [[:T_OR, nil]]
end
- example 'lex the plus operator' do
+ it 'lexes the plus operator' do
lex_xpath('+').should == [[:T_ADD, nil]]
end
- example 'lex the div operator' do
+ it 'lexes the div operator' do
lex_xpath(' div ').should == [[:T_DIV, nil]]
end
- example 'lex the mod operator' do
+ it 'lexes the mod operator' do
lex_xpath(' mod ').should == [[:T_MOD, nil]]
end
- example 'lex the equals operator' do
+ it 'lexes the equals operator' do
lex_xpath('=').should == [[:T_EQ, nil]]
end
- example 'lex the not-equals operator' do
+ it 'lexes the not-equals operator' do
lex_xpath('!=').should == [[:T_NEQ, nil]]
end
- example 'lex the lower-than operator' do
+ it 'lexes the lower-than operator' do
lex_xpath('<').should == [[:T_LT, nil]]
end
- example 'lex the greater-than operator' do
+ it 'lexes the greater-than operator' do
lex_xpath('>').should == [[:T_GT, nil]]
end
- example 'lex the lower-or-equal operator' do
+ it 'lexes the lower-or-equal operator' do
lex_xpath('<=').should == [[:T_LTE, nil]]
end
- example 'lex the greater-or-equal operator' do
+ it 'lexes the greater-or-equal operator' do
lex_xpath('>=').should == [[:T_GTE, nil]]
end
- example 'lex the mul operator' do
+ it 'lexes the mul operator' do
lex_xpath(' * ').should == [[:T_MUL, nil]]
end
- example 'lex the subtraction operator' do
+ it 'lexes the subtraction operator' do
lex_xpath(' - ').should == [[:T_SUB, nil]]
end
end
diff --git a/spec/oga/xpath/lexer/predicates_spec.rb b/spec/oga/xpath/lexer/predicates_spec.rb
index 2e0607e..1cfbfbc 100644
--- a/spec/oga/xpath/lexer/predicates_spec.rb
+++ b/spec/oga/xpath/lexer/predicates_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'predicates' do
- example 'lex a simple predicate expression' do
+ describe 'predicates' do
+ it 'lexes a simple predicate expression' do
lex_xpath('/foo[bar]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
@@ -12,7 +12,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate that checks for equality' do
+ it 'lexes a predicate that checks for equality' do
lex_xpath('/foo[@bar="baz"]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
@@ -25,7 +25,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate that user an integer' do
+ it 'lexes a predicate that user an integer' do
lex_xpath('/foo[1]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
@@ -35,7 +35,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate that uses a float' do
+ it 'lexes a predicate that uses a float' do
lex_xpath('/foo[1.5]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
@@ -45,7 +45,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate using a function' do
+ it 'lexes a predicate using a function' do
lex_xpath('/foo[bar()]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
@@ -57,7 +57,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate expression using the div operator' do
+ it 'lexes a predicate expression using the div operator' do
lex_xpath('/div[@number=4 div 2]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'div'],
@@ -72,7 +72,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate expression using the * operator' do
+ it 'lexes a predicate expression using the * operator' do
lex_xpath('/div[@number=4 * 2]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'div'],
@@ -87,7 +87,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate expression using axes' do
+ it 'lexes a predicate expression using axes' do
lex_xpath('/div[/foo/bar]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'div'],
@@ -100,7 +100,7 @@ describe Oga::XPath::Lexer do
]
end
- example 'lex a predicate expression using a wildcard' do
+ it 'lexes a predicate expression using a wildcard' do
lex_xpath('/div[/foo/*]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'div'],
diff --git a/spec/oga/xpath/lexer/strings_spec.rb b/spec/oga/xpath/lexer/strings_spec.rb
index 263fee6..6d97796 100644
--- a/spec/oga/xpath/lexer/strings_spec.rb
+++ b/spec/oga/xpath/lexer/strings_spec.rb
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'strings' do
- example 'lex a double quoted string' do
+ describe 'strings' do
+ it 'lexes a double quoted string' do
lex_xpath('"foo"').should == [[:T_STRING, 'foo']]
end
- example 'lex a single quoted string' do
+ it 'lexes a single quoted string' do
lex_xpath("'foo'").should == [[:T_STRING, 'foo']]
end
- example 'lex an empty double quoted string' do
+ it 'lexes an empty double quoted string' do
lex_xpath('""').should == [[:T_STRING, '']]
end
- example 'lex an empty single quoted string' do
+ it 'lexes an empty single quoted string' do
lex_xpath("''").should == [[:T_STRING, '']]
end
end
diff --git a/spec/oga/xpath/lexer/variable_spec.rb b/spec/oga/xpath/lexer/variable_spec.rb
index 5f23860..3ccb35f 100644
--- a/spec/oga/xpath/lexer/variable_spec.rb
+++ b/spec/oga/xpath/lexer/variable_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
- context 'variables' do
- example 'lex a variable reference' do
+ describe 'variables' do
+ it 'lexes a variable reference' do
lex_xpath('$foo').should == [[:T_VAR, 'foo']]
end
end
diff --git a/spec/oga/xpath/parser/axes_spec.rb b/spec/oga/xpath/parser/axes_spec.rb
index 8afe5b5..0c9dc67 100644
--- a/spec/oga/xpath/parser/axes_spec.rb
+++ b/spec/oga/xpath/parser/axes_spec.rb
@@ -1,92 +1,92 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'full axes' do
- example 'parse the ancestor axis' do
+ describe 'full axes' do
+ it 'parses the ancestor axis' do
parse_xpath('/ancestor::A').should == s(
:absolute_path,
s(:axis, 'ancestor', s(:test, nil, 'A'))
)
end
- example 'parse the ancestor-or-self axis' do
+ it 'parses the ancestor-or-self axis' do
parse_xpath('/ancestor-or-self::A').should == s(
:absolute_path,
s(:axis, 'ancestor-or-self', s(:test, nil, 'A'))
)
end
- example 'parse the attribute axis' do
+ it 'parses the attribute axis' do
parse_xpath('/attribute::A').should == s(
:absolute_path,
s(:axis, 'attribute', s(:test, nil, 'A'))
)
end
- example 'parse the child axis' do
+ it 'parses the child axis' do
parse_xpath('/child::A').should == s(
:absolute_path,
s(:axis, 'child', s(:test, nil, 'A'))
)
end
- example 'parse the descendant axis' do
+ it 'parses the descendant axis' do
parse_xpath('/descendant::A').should == s(
:absolute_path,
s(:axis, 'descendant', s(:test, nil, 'A'))
)
end
- example 'parse the descendant-or-self axis' do
+ it 'parses the descendant-or-self axis' do
parse_xpath('/descendant-or-self::A').should == s(
:absolute_path,
s(:axis, 'descendant-or-self', s(:test, nil, 'A'))
)
end
- example 'parse the following axis' do
+ it 'parses the following axis' do
parse_xpath('/following::A').should == s(
:absolute_path,
s(:axis, 'following', s(:test, nil, 'A'))
)
end
- example 'parse the following-sibling axis' do
+ it 'parses the following-sibling axis' do
parse_xpath('/following-sibling::A').should == s(
:absolute_path,
s(:axis, 'following-sibling', s(:test, nil, 'A'))
)
end
- example 'parse the namespace axis' do
+ it 'parses the namespace axis' do
parse_xpath('/namespace::A').should == s(
:absolute_path,
s(:axis, 'namespace', s(:test, nil, 'A'))
)
end
- example 'parse the parent axis' do
+ it 'parses the parent axis' do
parse_xpath('/parent::A').should == s(
:absolute_path,
s(:axis, 'parent', s(:test, nil, 'A'))
)
end
- example 'parse the preceding axis' do
+ it 'parses the preceding axis' do
parse_xpath('/preceding::A').should == s(
:absolute_path,
s(:axis, 'preceding', s(:test, nil, 'A'))
)
end
- example 'parse the preceding-sibling axis' do
+ it 'parses the preceding-sibling axis' do
parse_xpath('/preceding-sibling::A').should == s(
:absolute_path,
s(:axis, 'preceding-sibling', s(:test, nil, 'A'))
)
end
- example 'parse the self axis' do
+ it 'parses the self axis' do
parse_xpath('/self::A').should == s(
:absolute_path,
s(:axis, 'self', s(:test, nil, 'A'))
@@ -94,15 +94,15 @@ describe Oga::XPath::Parser do
end
end
- context 'short axes' do
- example 'parse the @attribute axis' do
+ describe 'short axes' do
+ it 'parses the @attribute axis' do
parse_xpath('/@A').should == s(
:absolute_path,
s(:axis, 'attribute', s(:test, nil, 'A'))
)
end
- example 'parse the // axis' do
+ it 'parses the // axis' do
parse_xpath('//A').should == s(
:absolute_path,
s(:axis, 'descendant-or-self', s(:type_test, 'node')),
@@ -110,14 +110,14 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the .. axis' do
+ it 'parses the .. axis' do
parse_xpath('/..').should == s(
:absolute_path,
s(:axis, 'parent', s(:type_test, 'node'))
)
end
- example 'parse the . axis' do
+ it 'parses the . axis' do
parse_xpath('/.').should == s(
:absolute_path,
s(:axis, 'self', s(:type_test, 'node'))
diff --git a/spec/oga/xpath/parser/calls_spec.rb b/spec/oga/xpath/parser/calls_spec.rb
index de16a4e..0e960ce 100644
--- a/spec/oga/xpath/parser/calls_spec.rb
+++ b/spec/oga/xpath/parser/calls_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'function calls' do
- example 'parse a function call without arguments' do
+ describe 'function calls' do
+ it 'parses a function call without arguments' do
parse_xpath('count()').should == s(:call, 'count')
end
- example 'parse a function call with a single argument' do
+ it 'parses a function call with a single argument' do
parse_xpath('count(/foo)').should == s(
:call,
'count',
@@ -14,7 +14,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse a function call with two arguments' do
+ it 'parses a function call with two arguments' do
parse_xpath('count(/foo, "bar")').should == s(
:call,
'count',
@@ -23,7 +23,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse a relative path with a function call' do
+ it 'parses a relative path with a function call' do
parse_xpath('foo/bar()').should == s(
:path,
s(:axis, 'child', s(:test, nil, 'foo')),
@@ -31,7 +31,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse an absolute path with a function call' do
+ it 'parses an absolute path with a function call' do
parse_xpath('/foo/bar()').should == s(
:absolute_path,
s(:axis, 'child', s(:test, nil, 'foo')),
@@ -39,7 +39,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse a predicate followed by a function call' do
+ it 'parses a predicate followed by a function call' do
parse_xpath('div[@class="foo"]/bar()').should == s(
:path,
s(
@@ -55,7 +55,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse two predicates followed by a function call' do
+ it 'parses two predicates followed by a function call' do
parse_xpath('A[@x]/B[@x]/bar()').should == s(
:path,
s(
diff --git a/spec/oga/xpath/parser/grouping_spec.rb b/spec/oga/xpath/parser/grouping_spec.rb
index 29250a8..01c656e 100644
--- a/spec/oga/xpath/parser/grouping_spec.rb
+++ b/spec/oga/xpath/parser/grouping_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'grouping of expressions' do
- example 'parse "A + (B + C)"' do
+ describe 'grouping of expressions' do
+ it 'parses "A + (B + C)"' do
parse_xpath('A + (B + C)').should == s(
:add,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -14,7 +14,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A or (B or C)"' do
+ it 'parses "A or (B or C)"' do
parse_xpath('A or (B or C)').should == s(
:or,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -26,7 +26,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "(A or B) and C"' do
+ it 'parses "(A or B) and C"' do
parse_xpath('(A or B) and C').should == s(
:and,
s(
diff --git a/spec/oga/xpath/parser/node_type_spec.rb b/spec/oga/xpath/parser/node_type_spec.rb
index c554d72..0c440a6 100644
--- a/spec/oga/xpath/parser/node_type_spec.rb
+++ b/spec/oga/xpath/parser/node_type_spec.rb
@@ -1,21 +1,21 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'node types' do
- example 'parse the "node" type' do
+ describe 'node types' do
+ it 'parses the "node" type' do
parse_xpath('node()').should == s(:axis, 'child', s(:type_test, 'node'))
end
- example 'parse the "comment" type' do
+ it 'parses the "comment" type' do
parse_xpath('comment()')
.should == s(:axis, 'child', s(:type_test, 'comment'))
end
- example 'parse the "text" type' do
+ it 'parses the "text" type' do
parse_xpath('text()').should == s(:axis, 'child', s(:type_test, 'text'))
end
- example 'parse the "processing-instruction" type' do
+ it 'parses the "processing-instruction" type' do
parse_xpath('processing-instruction()')
.should == s(:axis, 'child', s(:type_test, 'processing-instruction'))
end
diff --git a/spec/oga/xpath/parser/operator_precedence_spec.rb b/spec/oga/xpath/parser/operator_precedence_spec.rb
index 7de77be..0d6f07a 100644
--- a/spec/oga/xpath/parser/operator_precedence_spec.rb
+++ b/spec/oga/xpath/parser/operator_precedence_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'operator precedence' do
- example 'parse "A or B or C"' do
+ describe 'operator precedence' do
+ it 'parses "A or B or C"' do
parse_xpath('A or B or C').should == s(
:or,
s(
@@ -14,7 +14,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A and B and C"' do
+ it 'parses "A and B and C"' do
parse_xpath('A and B and C').should == s(
:and,
s(
@@ -26,7 +26,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A = B = C"' do
+ it 'parses "A = B = C"' do
parse_xpath('A = B = C').should == s(
:eq,
s(
@@ -38,7 +38,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A != B != C"' do
+ it 'parses "A != B != C"' do
parse_xpath('A != B != C').should == s(
:neq,
s(
@@ -50,7 +50,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A <= B <= C"' do
+ it 'parses "A <= B <= C"' do
parse_xpath('A <= B <= C').should == s(
:lte,
s(
@@ -62,7 +62,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A < B < C"' do
+ it 'parses "A < B < C"' do
parse_xpath('A < B < C').should == s(
:lt,
s(
@@ -74,7 +74,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A >= B >= C"' do
+ it 'parses "A >= B >= C"' do
parse_xpath('A >= B >= C').should == s(
:gte,
s(
@@ -86,7 +86,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A > B > C"' do
+ it 'parses "A > B > C"' do
parse_xpath('A > B > C').should == s(
:gt,
s(
@@ -98,7 +98,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A or B and C"' do
+ it 'parses "A or B and C"' do
parse_xpath('A or B and C').should == s(
:or,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -110,7 +110,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A and B = C"' do
+ it 'parses "A and B = C"' do
parse_xpath('A and B = C').should == s(
:and,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -122,7 +122,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A = B < C"' do
+ it 'parses "A = B < C"' do
parse_xpath('A = B < C').should == s(
:eq,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -134,7 +134,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A < B | C"' do
+ it 'parses "A < B | C"' do
parse_xpath('A < B | C').should == s(
:lt,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -146,7 +146,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse "A > B or C"' do
+ it 'parses "A > B or C"' do
parse_xpath('A > B or C').should == s(
:or,
s(
diff --git a/spec/oga/xpath/parser/operators_spec.rb b/spec/oga/xpath/parser/operators_spec.rb
index dbdf4d9..9442f53 100644
--- a/spec/oga/xpath/parser/operators_spec.rb
+++ b/spec/oga/xpath/parser/operators_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'operators' do
- example 'parse the pipe operator' do
+ describe 'operators' do
+ it 'parses the pipe operator' do
parse_xpath('A | B').should == s(
:pipe,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -10,7 +10,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the pipe operator using two paths' do
+ it 'parses the pipe operator using two paths' do
parse_xpath('A/B | C/D').should == s(
:pipe,
s(
@@ -26,7 +26,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the and operator' do
+ it 'parses the and operator' do
parse_xpath('A and B').should == s(
:and,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -34,7 +34,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the or operator' do
+ it 'parses the or operator' do
parse_xpath('A or B').should == s(
:or,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -42,7 +42,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the plus operator' do
+ it 'parses the plus operator' do
parse_xpath('A + B').should == s(
:add,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -50,7 +50,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the div operator' do
+ it 'parses the div operator' do
parse_xpath('A div B').should == s(
:div,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -58,7 +58,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the mod operator' do
+ it 'parses the mod operator' do
parse_xpath('A mod B').should == s(
:mod,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -66,7 +66,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the equals operator' do
+ it 'parses the equals operator' do
parse_xpath('A = B').should == s(
:eq,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -74,7 +74,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the not-equals operator' do
+ it 'parses the not-equals operator' do
parse_xpath('A != B').should == s(
:neq,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -82,7 +82,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the lower-than operator' do
+ it 'parses the lower-than operator' do
parse_xpath('A < B').should == s(
:lt,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -90,7 +90,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the greater-than operator' do
+ it 'parses the greater-than operator' do
parse_xpath('A > B').should == s(
:gt,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -98,7 +98,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the lower-or-equal operator' do
+ it 'parses the lower-or-equal operator' do
parse_xpath('A <= B').should == s(
:lte,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -106,7 +106,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the greater-or-equal operator' do
+ it 'parses the greater-or-equal operator' do
parse_xpath('A >= B').should == s(
:gte,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -114,7 +114,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the mul operator' do
+ it 'parses the mul operator' do
parse_xpath('A * B').should == s(
:mul,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -122,7 +122,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse the subtraction operator' do
+ it 'parses the subtraction operator' do
parse_xpath('A - B').should == s(
:sub,
s(:axis, 'child', s(:test, nil, 'A')),
diff --git a/spec/oga/xpath/parser/paths_spec.rb b/spec/oga/xpath/parser/paths_spec.rb
index ec907c8..501843e 100644
--- a/spec/oga/xpath/parser/paths_spec.rb
+++ b/spec/oga/xpath/parser/paths_spec.rb
@@ -1,19 +1,19 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'paths' do
- example 'parse an absolute path' do
+ describe 'paths' do
+ it 'parses an absolute path' do
parse_xpath('/A').should == s(
:absolute_path,
s(:axis, 'child', s(:test, nil, 'A'))
)
end
- example 'parse a relative path' do
+ it 'parses a relative path' do
parse_xpath('A').should == s(:axis, 'child', s(:test, nil, 'A'))
end
- example 'parse an expression using two paths' do
+ it 'parses an expression using two paths' do
parse_xpath('/A/B').should == s(
:absolute_path,
s(:axis, 'child', s(:test, nil, 'A')),
@@ -21,7 +21,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse an absolute path without a node test' do
+ it 'parses an absolute path without a node test' do
parse_xpath('/').should == s(:absolute_path)
end
end
diff --git a/spec/oga/xpath/parser/predicates_spec.rb b/spec/oga/xpath/parser/predicates_spec.rb
index 2b15e18..d87316d 100644
--- a/spec/oga/xpath/parser/predicates_spec.rb
+++ b/spec/oga/xpath/parser/predicates_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'predicates' do
- example 'parse a single predicate' do
+ describe 'predicates' do
+ it 'parses a single predicate' do
parse_xpath('foo[@class="bar"]').should == s(
:predicate,
s(:axis, 'child', s(:test, nil, 'foo')),
@@ -14,7 +14,7 @@ describe Oga::XPath::Parser do
)
end
- example 'parse a predicate using the or operator' do
+ it 'parses a predicate using the or operator' do
parse_xpath('foo[@x="bar" or @x="baz"]').should == s(
:predicate,
s(:axis, 'child', s(:test, nil, 'foo')),
diff --git a/spec/oga/xpath/parser/variable_spec.rb b/spec/oga/xpath/parser/variable_spec.rb
index dc7ba0d..026b6b0 100644
--- a/spec/oga/xpath/parser/variable_spec.rb
+++ b/spec/oga/xpath/parser/variable_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'variables' do
- example 'parse a variable reference' do
+ describe 'variables' do
+ it 'parses a variable reference' do
parse_xpath('$foo').should == s(:var, 'foo')
end
- example 'parse a variable reference in a predicate' do
+ it 'parses a variable reference in a predicate' do
parse_xpath('foo[$bar]').should == s(
:predicate,
s(:axis, 'child', s(:test, nil, 'foo')),
diff --git a/spec/oga/xpath/parser/wildcard_spec.rb b/spec/oga/xpath/parser/wildcard_spec.rb
index 5eeae32..b2eb1f9 100644
--- a/spec/oga/xpath/parser/wildcard_spec.rb
+++ b/spec/oga/xpath/parser/wildcard_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Oga::XPath::Parser do
- context 'wildcards' do
- example 'parse a wildcard name test' do
+ describe 'wildcards' do
+ it 'parses a wildcard name test' do
parse_xpath('*').should == s(:axis, 'child', s(:test, nil, '*'))
end
- example 'parse a wildcard namespace test' do
+ it 'parses a wildcard namespace test' do
parse_xpath('*:A').should == s(:axis, 'child', s(:test, '*', 'A'))
end
- example 'parse a wildcard namespace and name test' do
+ it 'parses a wildcard namespace and name test' do
parse_xpath('*:*').should == s(:axis, 'child', s(:test, '*', '*'))
end
end