summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/rexml/element/add_attributes_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/library/rexml/element/add_attributes_spec.rb')
-rw-r--r--spec/rubyspec/library/rexml/element/add_attributes_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/rubyspec/library/rexml/element/add_attributes_spec.rb b/spec/rubyspec/library/rexml/element/add_attributes_spec.rb
new file mode 100644
index 0000000000..aa64b677ca
--- /dev/null
+++ b/spec/rubyspec/library/rexml/element/add_attributes_spec.rb
@@ -0,0 +1,22 @@
+require 'rexml/document'
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+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