aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/rexml/element/add_text_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/rexml/element/add_text_spec.rb')
-rw-r--r--spec/ruby/library/rexml/element/add_text_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/library/rexml/element/add_text_spec.rb b/spec/ruby/library/rexml/element/add_text_spec.rb
new file mode 100644
index 0000000000..5d116ee6d3
--- /dev/null
+++ b/spec/ruby/library/rexml/element/add_text_spec.rb
@@ -0,0 +1,24 @@
+require 'rexml/document'
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+describe "REXML::Element#add_namespace" do
+ before :each do
+ @name = REXML::Element.new "Name"
+ end
+
+ it "adds text to an element" do
+ @name.add_text "Ringo"
+ @name.to_s.should == "<Name>Ringo</Name>"
+ end
+
+ it "accepts a Text" do
+ @name.add_text(REXML::Text.new("Ringo"))
+ @name.to_s.should == "<Name>Ringo</Name>"
+ end
+
+ it "joins the new text with the old one" do
+ @name.add_text "Ringo"
+ @name.add_text " Starr"
+ @name.to_s.should == "<Name>Ringo Starr</Name>"
+ end
+end