2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-09-15 15:54:31 -04:00
|
|
|
ruby_version_is ''...'3.0' do
|
2020-01-11 18:14:26 -05:00
|
|
|
require 'rexml/document'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-01-11 18:14:26 -05:00
|
|
|
describe "REXML::Element#add_attributes" 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
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-01-11 18:14:26 -05:00
|
|
|
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
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|