From 75e96ee7799372f71596b1635744883557579b10 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 1 Jul 2014 10:07:35 +0200 Subject: [PATCH] Test for Document#children= with a NodeSet. --- spec/oga/xml/document_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/oga/xml/document_spec.rb b/spec/oga/xml/document_spec.rb index 0a3607a..9dba917 100644 --- a/spec/oga/xml/document_spec.rb +++ b/spec/oga/xml/document_spec.rb @@ -8,8 +8,10 @@ describe Oga::XML::Document do document.children[0].should == child end + end - example 'set the child nodes via a setter' do + context '#children=' do + example 'set the child nodes using an Array' do child = Oga::XML::Comment.new(:text => 'foo') document = described_class.new @@ -17,6 +19,15 @@ describe Oga::XML::Document do document.children[0].should == child end + + example 'set the child nodes using a NodeSet' do + child = Oga::XML::Comment.new(:text => 'foo') + document = described_class.new + + document.children = Oga::XML::NodeSet.new([child]) + + document.children[0].should == child + end end context '#to_xml' do