aboutsummaryrefslogtreecommitdiffstats
path: root/spec/rubyspec/library/rexml/attributes/shared/add.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/library/rexml/attributes/shared/add.rb')
-rw-r--r--spec/rubyspec/library/rexml/attributes/shared/add.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/rubyspec/library/rexml/attributes/shared/add.rb b/spec/rubyspec/library/rexml/attributes/shared/add.rb
new file mode 100644
index 0000000000..872f149f45
--- /dev/null
+++ b/spec/rubyspec/library/rexml/attributes/shared/add.rb
@@ -0,0 +1,17 @@
+describe :rexml_attribute_add, shared: true do
+ before :each do
+ @e = REXML::Element.new("root")
+ @attr = REXML::Attributes.new(@e)
+ @name = REXML::Attribute.new("name", "Joe")
+ end
+
+ it "adds an attribute" do
+ @attr.send(@method, @name)
+ @attr["name"].should == "Joe"
+ end
+
+ it "replaces an existing attribute" do
+ @attr.send(@method, REXML::Attribute.new("name", "Bruce"))
+ @attr["name"].should == "Bruce"
+ end
+end