Sha256: 442299ba413ef96202247b12ca99d3c6d0f0c2e2af4f2c9d389aba70d478e208

Contents?: true

Size: 534 Bytes

Versions: 5

Compression:

Stored size: 534 Bytes

Contents

require 'rexml/document'

describe "REXML::Attributes#to_a" do
  it "returns an array with the attributes" do
    e = REXML::Element.new("root")
    name = REXML::Attribute.new("name", "Dave")
    last = REXML::Attribute.new("last_name", "Murray")

    e.attributes << name
    e.attributes << last

    result = e.attributes.to_a.sort { |a, b| a.to_s <=> b.to_s }
    result.should == [name, last]
  end

  it "returns an empty array if it has no attributes" do
    REXML::Element.new("root").attributes.to_a.should == []
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysl-rexml-2.0.4 spec/attributes/to_a_spec.rb
rubysl-rexml-2.0.3 spec/attributes/to_a_spec.rb
rubysl-rexml-1.0.0 spec/attributes/to_a_spec.rb
rubysl-rexml-2.0.2 spec/attributes/to_a_spec.rb
rubysl-rexml-2.0.1 spec/attributes/to_a_spec.rb