aboutsummaryrefslogtreecommitdiffstats
path: root/spec/rubyspec/library/rexml/element/add_text_spec.rb
blob: 5d116ee6d3da6d5644020349b2ad14b4542e16d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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