Sha256: 16964013466a3ac956947e6969fd75fa460d0a96eed9a2cfdcdb38e1fec4af9a

Contents?: true

Size: 684 Bytes

Versions: 5

Compression:

Stored size: 684 Bytes

Contents

require 'rexml/document'

describe "REXML::Element#inspect" do

  before :each do
    @name = REXML::Element.new "name"
  end

  it "returns the node as a string" do
    @name.inspect.should == "<name/>"
  end

  it "inserts '...' if the node has children" do
    e = REXML::Element.new "last_name"
    @name << e
    @name.inspect.should == "<name> ... </>"
    # This might make more sense but differs from MRI's default behavior
    # @name.inspect.should == "<name> ... </name>"
  end

  it "inserts the attributes in the string" do
    @name.add_attribute "language"
    @name.attributes["language"] = "english"
    @name.inspect.should == "<name language='english'/>"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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