aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/rexml/document/xml_decl_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/rexml/document/xml_decl_spec.rb')
-rw-r--r--spec/ruby/library/rexml/document/xml_decl_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/ruby/library/rexml/document/xml_decl_spec.rb b/spec/ruby/library/rexml/document/xml_decl_spec.rb
new file mode 100644
index 0000000000..6a5bf07c0b
--- /dev/null
+++ b/spec/ruby/library/rexml/document/xml_decl_spec.rb
@@ -0,0 +1,15 @@
+require 'rexml/document'
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+describe "REXML::Document#xml_decl" do
+ it "returns XML declaration of the document" do
+ d = REXML::Document.new
+ decl = REXML::XMLDecl.new("1.0", "UTF-16", "yes")
+ d.add decl
+ d.xml_decl.should == decl
+ end
+
+ it "returns default XML declaration unless present" do
+ REXML::Document.new.xml_decl.should == REXML::XMLDecl.new
+ end
+end