Sha256: af675eaf865a96c11ca54cbf07176b41de8abafafde9d2da9d2dc289658845bc

Contents?: true

Size: 608 Bytes

Versions: 5

Compression:

Stored size: 608 Bytes

Contents

require 'rexml/document'

describe "REXML::Element#clone" do
  before :each do
    @e = REXML::Element.new "a"
  end
  it "creates a copy of element" do
    @e.clone.to_s.should == @e.to_s
  end

  it "copies the attributes" do
    @e.add_attribute("foo", "bar")
    @e.clone.to_s.should == @e.to_s
  end

  it "does not copy the text" do
    @e.add_text "some text..."
    @e.clone.to_s.should_not == @e
    @e.clone.to_s.should == "<a/>"
  end

  it "does not copy the child elements" do
    b = REXML::Element.new "b"
    @e << b
    @e.clone.should_not == @e
    @e.clone.to_s.should == "<a/>"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysl-rexml-2.0.4 spec/element/clone_spec.rb
rubysl-rexml-2.0.3 spec/element/clone_spec.rb
rubysl-rexml-1.0.0 spec/element/clone_spec.rb
rubysl-rexml-2.0.2 spec/element/clone_spec.rb
rubysl-rexml-2.0.1 spec/element/clone_spec.rb