Test for Document#children= with a NodeSet.

This commit is contained in:
Yorick Peterse 2014-07-01 10:07:35 +02:00
parent 4e2b7f529d
commit 75e96ee779
1 changed files with 12 additions and 1 deletions

View File

@ -8,8 +8,10 @@ describe Oga::XML::Document do
document.children[0].should == child document.children[0].should == child
end 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') child = Oga::XML::Comment.new(:text => 'foo')
document = described_class.new document = described_class.new
@ -17,6 +19,15 @@ describe Oga::XML::Document do
document.children[0].should == child document.children[0].should == child
end 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 end
context '#to_xml' do context '#to_xml' do