Sha256: f838eaeb3ea1aa0c600b87dfba10679d88e25463c844919a8f031770648b701d

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

require 'rexml/document'

describe "REXML::Attributes#each" do
  before :each 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
  end

  it "iterates over the attributes yielding expanded-name/value" do
    attributes = []
    @e.attributes.each do |attr|
      attr.should be_kind_of(Array)
      attributes << attr
    end
    attributes = attributes.sort_by {|a| a.first }
    attributes.first.should == ["name", "Joe"]
    attributes.last.should == ["xmlns:ns", "http://some_uri"]
  end
end


Version data entries

5 entries across 5 versions & 1 rubygems

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