From 4b408eae4ff775b871439d6ee3d32e68fb4ac0c8 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 1 Jul 2014 10:09:42 +0200 Subject: [PATCH] Tests for Node#children=. --- spec/oga/xml/node_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/oga/xml/node_spec.rb b/spec/oga/xml/node_spec.rb index 4cc196e..2123693 100644 --- a/spec/oga/xml/node_spec.rb +++ b/spec/oga/xml/node_spec.rb @@ -15,4 +15,24 @@ describe Oga::XML::Node do described_class.new.node_type.should == :node end end + + context '#children=' do + example 'set the child nodes using an Array' do + child = described_class.new + node = described_class.new + + node.children = [child] + + node.children[0].should == child + end + + example 'set the child nodes using a NodeSet' do + child = described_class.new + node = described_class.new + + node.children = Oga::XML::NodeSet.new([child]) + + node.children[0].should == child + end + end end