Sha256: 5b18fbb05f59f01900d52cf090b5dd1cc27be742b079f2e4ac428aed45cee712

Contents?: true

Size: 619 Bytes

Versions: 5

Compression:

Stored size: 619 Bytes

Contents

require 'rexml/document'

describe "REXML::Element#add_attribute" do
  before :each do
    @person = REXML::Element.new "person"
    @person.attributes["name"] = "Bill"
  end

  it "adds multiple attributes from a hash" do
    @person.add_attributes({"name" => "Joe", "age" => "27"})
    @person.attributes["name"].should == "Joe"
    @person.attributes["age"].should == "27"
  end

  it "adds multiple attributes from an array" do
    attrs =  { "name" => "Joe", "age" => "27"}
    @person.add_attributes attrs.to_a
    @person.attributes["name"].should == "Joe"
    @person.attributes["age"].should == "27"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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