summaryrefslogtreecommitdiff
path: root/spec/ruby/library/rexml/element
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-28 15:15:48 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-28 15:15:48 +0000
commit8c5b60eb22d6d661e87992a65d54e3a5bc0aeed4 (patch)
tree7905b284cb5b3d62c17ad8a939e339621a498a2c /spec/ruby/library/rexml/element
parent6530b14cee76e2512424d225e64d3c61dd1f6511 (diff)
Update to ruby/spec@a6b8805
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/rexml/element')
-rw-r--r--spec/ruby/library/rexml/element/add_attributes_spec.rb2
-rw-r--r--spec/ruby/library/rexml/element/add_text_spec.rb2
-rw-r--r--spec/ruby/library/rexml/element/element_reference_spec.rb22
3 files changed, 24 insertions, 2 deletions
diff --git a/spec/ruby/library/rexml/element/add_attributes_spec.rb b/spec/ruby/library/rexml/element/add_attributes_spec.rb
index aa64b677ca..d4c0f0a6e2 100644
--- a/spec/ruby/library/rexml/element/add_attributes_spec.rb
+++ b/spec/ruby/library/rexml/element/add_attributes_spec.rb
@@ -1,7 +1,7 @@
require 'rexml/document'
require File.expand_path('../../../../spec_helper', __FILE__)
-describe "REXML::Element#add_attribute" do
+describe "REXML::Element#add_attributes" do
before :each do
@person = REXML::Element.new "person"
@person.attributes["name"] = "Bill"
diff --git a/spec/ruby/library/rexml/element/add_text_spec.rb b/spec/ruby/library/rexml/element/add_text_spec.rb
index 5d116ee6d3..2f77b5f9f7 100644
--- a/spec/ruby/library/rexml/element/add_text_spec.rb
+++ b/spec/ruby/library/rexml/element/add_text_spec.rb
@@ -1,7 +1,7 @@
require 'rexml/document'
require File.expand_path('../../../../spec_helper', __FILE__)
-describe "REXML::Element#add_namespace" do
+describe "REXML::Element#add_text" do
before :each do
@name = REXML::Element.new "Name"
end
diff --git a/spec/ruby/library/rexml/element/element_reference_spec.rb b/spec/ruby/library/rexml/element/element_reference_spec.rb
new file mode 100644
index 0000000000..eb01169137
--- /dev/null
+++ b/spec/ruby/library/rexml/element/element_reference_spec.rb
@@ -0,0 +1,22 @@
+require 'rexml/document'
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+describe "REXML::Element#[]" do
+
+ before :each do
+ @doc = REXML::Document.new("<root foo='bar'></root>")
+ @child = REXML::Element.new("child")
+ @doc.root.add_element @child
+ end
+
+ ruby_version_is "2.4" do
+ it "return attribute value if argument is string or symbol" do
+ @doc.root[:foo].should == 'bar'
+ @doc.root['foo'].should == 'bar'
+ end
+
+ it "return nth element if argument is int" do
+ @doc.root[0].should == @child
+ end
+ end
+end