Sha256: 3696ce1d8fa04c35ca718c1268e2a3f525b60d232240b3bdc51b4738df67bb02

Contents?: true

Size: 579 Bytes

Versions: 5

Compression:

Stored size: 579 Bytes

Contents

require 'rexml/document'

describe "REXML::Attributes#each_attribute" do
  it "iterates over the attributes yielding actual Attribute objects" do
    e = REXML::Element.new("root")
    name = REXML::Attribute.new("name", "Joe")
    ns_uri = REXML::Attribute.new("xmlns:ns", "http://some_uri")
    e.add_attribute name
    e.add_attribute ns_uri

    attributes = []

    e.attributes.each_attribute do |attr|
      attributes << attr
    end

    attributes = attributes.sort_by {|a| a.name }
    attributes.first.should == name
    attributes.last.should == ns_uri
  end
end



Version data entries

5 entries across 5 versions & 1 rubygems

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