diff options
Diffstat (limited to 'spec/ruby/library/rexml/element')
-rw-r--r-- | spec/ruby/library/rexml/element/add_attributes_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/library/rexml/element/add_text_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/library/rexml/element/element_reference_spec.rb | 22 |
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 |