diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-01-12 08:14:26 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2020-01-12 12:28:29 +0900 |
commit | e61cab3a367c4040a2a487dd893c7be9a37889a9 (patch) | |
tree | c6ea3e3c929fcb5fd17197abea387173912f624b /spec/ruby/library/rexml/attributes | |
parent | 83240f315a10b42b53c3b62c1fbc428f97912665 (diff) |
Ignore rexml examples on ruby/spec
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2832
Diffstat (limited to 'spec/ruby/library/rexml/attributes')
16 files changed, 245 insertions, 197 deletions
diff --git a/spec/ruby/library/rexml/attributes/add_spec.rb b/spec/ruby/library/rexml/attributes/add_spec.rb index 32a927e10b..fd23bd458c 100644 --- a/spec/ruby/library/rexml/attributes/add_spec.rb +++ b/spec/ruby/library/rexml/attributes/add_spec.rb @@ -1,7 +1,10 @@ require_relative '../../../spec_helper' -require_relative 'shared/add' -require 'rexml/document' -describe "REXML::Attributes#add" do - it_behaves_like :rexml_attribute_add, :add +ruby_version_is ''...'2.8' do + require_relative 'shared/add' + require 'rexml/document' + + describe "REXML::Attributes#add" do + it_behaves_like :rexml_attribute_add, :add + end end diff --git a/spec/ruby/library/rexml/attributes/append_spec.rb b/spec/ruby/library/rexml/attributes/append_spec.rb index f1b08f7d6a..99585979f2 100644 --- a/spec/ruby/library/rexml/attributes/append_spec.rb +++ b/spec/ruby/library/rexml/attributes/append_spec.rb @@ -1,7 +1,10 @@ require_relative '../../../spec_helper' -require_relative 'shared/add' -require 'rexml/document' -describe "REXML::Attributes#<<" do - it_behaves_like :rexml_attribute_add, :<< +ruby_version_is ''...'2.8' do + require_relative 'shared/add' + require 'rexml/document' + + describe "REXML::Attributes#<<" do + it_behaves_like :rexml_attribute_add, :<< + end end diff --git a/spec/ruby/library/rexml/attributes/delete_all_spec.rb b/spec/ruby/library/rexml/attributes/delete_all_spec.rb index 9340b5693b..f5e6a897c5 100644 --- a/spec/ruby/library/rexml/attributes/delete_all_spec.rb +++ b/spec/ruby/library/rexml/attributes/delete_all_spec.rb @@ -1,31 +1,34 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#delete_all" do - before :each do - @e = REXML::Element.new("root") - end +ruby_version_is ''...'2.8' do + require 'rexml/document' - it "deletes all attributes that match name" do - uri = REXML::Attribute.new("uri", "http://something") - @e.attributes << uri - @e.attributes.delete_all("uri") - @e.attributes.should be_empty - @e.attributes["uri"].should == nil - end + describe "REXML::Attributes#delete_all" do + before :each do + @e = REXML::Element.new("root") + end - it "deletes all attributes that match name with a namespace" do - ns_uri = REXML::Attribute.new("xmlns:uri", "http://something_here_too") - @e.attributes << ns_uri - @e.attributes.delete_all("xmlns:uri") - @e.attributes.should be_empty - @e.attributes["xmlns:uri"].should == nil - end + it "deletes all attributes that match name" do + uri = REXML::Attribute.new("uri", "http://something") + @e.attributes << uri + @e.attributes.delete_all("uri") + @e.attributes.should be_empty + @e.attributes["uri"].should == nil + end + + it "deletes all attributes that match name with a namespace" do + ns_uri = REXML::Attribute.new("xmlns:uri", "http://something_here_too") + @e.attributes << ns_uri + @e.attributes.delete_all("xmlns:uri") + @e.attributes.should be_empty + @e.attributes["xmlns:uri"].should == nil + end - it "returns the removed attribute" do - uri = REXML::Attribute.new("uri", "http://something_here_too") - @e.attributes << uri - attrs = @e.attributes.delete_all("uri") - attrs.first.should == uri + it "returns the removed attribute" do + uri = REXML::Attribute.new("uri", "http://something_here_too") + @e.attributes << uri + attrs = @e.attributes.delete_all("uri") + attrs.first.should == uri + end end end diff --git a/spec/ruby/library/rexml/attributes/delete_spec.rb b/spec/ruby/library/rexml/attributes/delete_spec.rb index 495e4085ef..59641e55db 100644 --- a/spec/ruby/library/rexml/attributes/delete_spec.rb +++ b/spec/ruby/library/rexml/attributes/delete_spec.rb @@ -1,27 +1,30 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#delete" do - before :each do - @e = REXML::Element.new("root") - @name = REXML::Attribute.new("name", "Pepe") - end +ruby_version_is ''...'2.8' do + require 'rexml/document' - it "takes an attribute name and deletes the attribute" do - @e.attributes.delete("name") - @e.attributes["name"].should be_nil - @e.attributes.should be_empty - end + describe "REXML::Attributes#delete" do + before :each do + @e = REXML::Element.new("root") + @name = REXML::Attribute.new("name", "Pepe") + end - it "takes an Attribute and deletes it" do - @e.attributes.delete(@name) - @e.attributes["name"].should be_nil - @e.attributes.should be_empty - end + it "takes an attribute name and deletes the attribute" do + @e.attributes.delete("name") + @e.attributes["name"].should be_nil + @e.attributes.should be_empty + end + + it "takes an Attribute and deletes it" do + @e.attributes.delete(@name) + @e.attributes["name"].should be_nil + @e.attributes.should be_empty + end - it "returns the element with the attribute removed" do - ret_val = @e.attributes.delete(@name) - ret_val.should == @e - ret_val.attributes.should be_empty + it "returns the element with the attribute removed" do + ret_val = @e.attributes.delete(@name) + ret_val.should == @e + ret_val.attributes.should be_empty + end end end diff --git a/spec/ruby/library/rexml/attributes/each_attribute_spec.rb b/spec/ruby/library/rexml/attributes/each_attribute_spec.rb index e84c8dbf51..1e6b5c1c1f 100644 --- a/spec/ruby/library/rexml/attributes/each_attribute_spec.rb +++ b/spec/ruby/library/rexml/attributes/each_attribute_spec.rb @@ -1,22 +1,25 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#each_attribute" do - it "iterates over the attributes yielding actual Attribute objects" do - e = REXML::Element.new("root") - name = REXML::Attribute.new("name", "Joe") - ns_uri = REXML::Attribute.new("xmlns:ns", "http://some_uri") - e.add_attribute name - e.add_attribute ns_uri +ruby_version_is ''...'2.8' do + require 'rexml/document' - attributes = [] + describe "REXML::Attributes#each_attribute" do + it "iterates over the attributes yielding actual Attribute objects" do + e = REXML::Element.new("root") + name = REXML::Attribute.new("name", "Joe") + ns_uri = REXML::Attribute.new("xmlns:ns", "http://some_uri") + e.add_attribute name + e.add_attribute ns_uri - e.attributes.each_attribute do |attr| - attributes << attr - end + attributes = [] + + e.attributes.each_attribute do |attr| + attributes << attr + end - attributes = attributes.sort_by {|a| a.name } - attributes.first.should == name - attributes.last.should == ns_uri + attributes = attributes.sort_by {|a| a.name } + attributes.first.should == name + attributes.last.should == ns_uri + end end end diff --git a/spec/ruby/library/rexml/attributes/each_spec.rb b/spec/ruby/library/rexml/attributes/each_spec.rb index ed60634b90..4865114cf1 100644 --- a/spec/ruby/library/rexml/attributes/each_spec.rb +++ b/spec/ruby/library/rexml/attributes/each_spec.rb @@ -1,23 +1,26 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#each" do - before :each do - @e = REXML::Element.new("root") - @name = REXML::Attribute.new("name", "Joe") - @ns_uri = REXML::Attribute.new("xmlns:ns", "http://some_uri") - @e.add_attribute @name - @e.add_attribute @ns_uri - end +ruby_version_is ''...'2.8' do + require 'rexml/document' + + describe "REXML::Attributes#each" do + before :each do + @e = REXML::Element.new("root") + @name = REXML::Attribute.new("name", "Joe") + @ns_uri = REXML::Attribute.new("xmlns:ns", "http://some_uri") + @e.add_attribute @name + @e.add_attribute @ns_uri + end - it "iterates over the attributes yielding expanded-name/value" do - attributes = [] - @e.attributes.each do |attr| - attr.should be_kind_of(Array) - attributes << attr + it "iterates over the attributes yielding expanded-name/value" do + attributes = [] + @e.attributes.each do |attr| + attr.should be_kind_of(Array) + attributes << attr + end + attributes = attributes.sort_by {|a| a.first } + attributes.first.should == ["name", "Joe"] + attributes.last.should == ["xmlns:ns", "http://some_uri"] end - attributes = attributes.sort_by {|a| a.first } - attributes.first.should == ["name", "Joe"] - attributes.last.should == ["xmlns:ns", "http://some_uri"] end end diff --git a/spec/ruby/library/rexml/attributes/element_reference_spec.rb b/spec/ruby/library/rexml/attributes/element_reference_spec.rb index dac7952669..86e0c57fc9 100644 --- a/spec/ruby/library/rexml/attributes/element_reference_spec.rb +++ b/spec/ruby/library/rexml/attributes/element_reference_spec.rb @@ -1,18 +1,21 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#[]" do - before :each do - @e = REXML::Element.new("root") - @lang = REXML::Attribute.new("language", "english") - @e.attributes << @lang - end +ruby_version_is ''...'2.8' do + require 'rexml/document' - it "returns the value of an attribute" do - @e.attributes["language"].should == "english" - end + describe "REXML::Attributes#[]" do + before :each do + @e = REXML::Element.new("root") + @lang = REXML::Attribute.new("language", "english") + @e.attributes << @lang + end + + it "returns the value of an attribute" do + @e.attributes["language"].should == "english" + end - it "returns nil if the attribute does not exist" do - @e.attributes["chunky bacon"].should == nil + it "returns nil if the attribute does not exist" do + @e.attributes["chunky bacon"].should == nil + end end end diff --git a/spec/ruby/library/rexml/attributes/element_set_spec.rb b/spec/ruby/library/rexml/attributes/element_set_spec.rb index 1ed94dd2a1..90096be82c 100644 --- a/spec/ruby/library/rexml/attributes/element_set_spec.rb +++ b/spec/ruby/library/rexml/attributes/element_set_spec.rb @@ -1,25 +1,28 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#[]=" do - before :each do - @e = REXML::Element.new("song") - @name = REXML::Attribute.new("name", "Holy Smoke!") - @e.attributes << @name - end +ruby_version_is ''...'2.8' do + require 'rexml/document' - it "sets an attribute" do - @e.attributes["author"] = "_why's foxes" - @e.attributes["author"].should == "_why's foxes" - end + describe "REXML::Attributes#[]=" do + before :each do + @e = REXML::Element.new("song") + @name = REXML::Attribute.new("name", "Holy Smoke!") + @e.attributes << @name + end - it "overwrites an existing attribute" do - @e.attributes["name"] = "Chunky Bacon" - @e.attributes["name"].should == "Chunky Bacon" - end + it "sets an attribute" do + @e.attributes["author"] = "_why's foxes" + @e.attributes["author"].should == "_why's foxes" + end + + it "overwrites an existing attribute" do + @e.attributes["name"] = "Chunky Bacon" + @e.attributes["name"].should == "Chunky Bacon" + end - it "deletes an attribute is value is nil" do - @e.attributes["name"] = nil - @e.attributes.length.should == 0 + it "deletes an attribute is value is nil" do + @e.attributes["name"] = nil + @e.attributes.length.should == 0 + end end end diff --git a/spec/ruby/library/rexml/attributes/get_attribute_ns_spec.rb b/spec/ruby/library/rexml/attributes/get_attribute_ns_spec.rb index 1664d6e42a..56ed733d37 100644 --- a/spec/ruby/library/rexml/attributes/get_attribute_ns_spec.rb +++ b/spec/ruby/library/rexml/attributes/get_attribute_ns_spec.rb @@ -1,14 +1,17 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#get_attribute_ns" do - it "returns an attribute by name and namespace" do - e = REXML::Element.new("root") - attr = REXML::Attribute.new("xmlns:ns", "http://some_url") - e.attributes << attr - attr.prefix.should == "xmlns" - # This might be a bug in Attribute, commenting until those specs - # are ready - # e.attributes.get_attribute_ns(attr.prefix, "name").should == "http://some_url" +ruby_version_is ''...'2.8' do + require 'rexml/document' + + describe "REXML::Attributes#get_attribute_ns" do + it "returns an attribute by name and namespace" do + e = REXML::Element.new("root") + attr = REXML::Attribute.new("xmlns:ns", "http://some_url") + e.attributes << attr + attr.prefix.should == "xmlns" + # This might be a bug in Attribute, commenting until those specs + # are ready + # e.attributes.get_attribute_ns(attr.prefix, "name").should == "http://some_url" + end end end diff --git a/spec/ruby/library/rexml/attributes/get_attribute_spec.rb b/spec/ruby/library/rexml/attributes/get_attribute_spec.rb index cfe58c1b9e..cf08446eaf 100644 --- a/spec/ruby/library/rexml/attributes/get_attribute_spec.rb +++ b/spec/ruby/library/rexml/attributes/get_attribute_spec.rb @@ -1,29 +1,32 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#get_attribute" do - before :each do - @e = REXML::Element.new("root") - @name = REXML::Attribute.new("name", "Dave") - @e.attributes << @name - end +ruby_version_is ''...'2.8' do + require 'rexml/document' - it "fetches an attributes" do - @e.attributes.get_attribute("name").should == @name - end + describe "REXML::Attributes#get_attribute" do + before :each do + @e = REXML::Element.new("root") + @name = REXML::Attribute.new("name", "Dave") + @e.attributes << @name + end - it "fetches an namespaced attribute" do - ns_name = REXML::Attribute.new("im:name", "Murray") - @e.attributes << ns_name - @e.attributes.get_attribute("name").should == @name - @e.attributes.get_attribute("im:name").should == ns_name - end + it "fetches an attributes" do + @e.attributes.get_attribute("name").should == @name + end - it "returns an Attribute" do - @e.attributes.get_attribute("name").should be_kind_of(REXML::Attribute) - end + it "fetches an namespaced attribute" do + ns_name = REXML::Attribute.new("im:name", "Murray") + @e.attributes << ns_name + @e.attributes.get_attribute("name").should == @name + @e.attributes.get_attribute("im:name").should == ns_name + end + + it "returns an Attribute" do + @e.attributes.get_attribute("name").should be_kind_of(REXML::Attribute) + end - it "returns nil if it attribute does not exist" do - @e.attributes.get_attribute("fake").should be_nil + it "returns nil if it attribute does not exist" do + @e.attributes.get_attribute("fake").should be_nil + end end end diff --git a/spec/ruby/library/rexml/attributes/initialize_spec.rb b/spec/ruby/library/rexml/attributes/initialize_spec.rb index f18bd20c69..f7c9652171 100644 --- a/spec/ruby/library/rexml/attributes/initialize_spec.rb +++ b/spec/ruby/library/rexml/attributes/initialize_spec.rb @@ -1,18 +1,21 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#initialize" do - it "is auto initialized by Element" do - e = REXML::Element.new "root" - e.attributes.should be_kind_of(REXML::Attributes) +ruby_version_is ''...'2.8' do + require 'rexml/document' - e.attributes << REXML::Attribute.new("name", "Paul") - e.attributes["name"].should == "Paul" - end + describe "REXML::Attributes#initialize" do + it "is auto initialized by Element" do + e = REXML::Element.new "root" + e.attributes.should be_kind_of(REXML::Attributes) + + e.attributes << REXML::Attribute.new("name", "Paul") + e.attributes["name"].should == "Paul" + end - it "receives a parent node" do - e = REXML::Element.new "root" - e.attributes << REXML::Attribute.new("name", "Vic") - e.attributes["name"].should == "Vic" + it "receives a parent node" do + e = REXML::Element.new "root" + e.attributes << REXML::Attribute.new("name", "Vic") + e.attributes["name"].should == "Vic" + end end end diff --git a/spec/ruby/library/rexml/attributes/length_spec.rb b/spec/ruby/library/rexml/attributes/length_spec.rb index 3a8361b8d7..60a348ef7b 100644 --- a/spec/ruby/library/rexml/attributes/length_spec.rb +++ b/spec/ruby/library/rexml/attributes/length_spec.rb @@ -1,7 +1,10 @@ require_relative '../../../spec_helper' -require_relative 'shared/length' -require 'rexml/document' -describe "REXML::Attributes#length" do - it_behaves_like :rexml_attribute_length, :length +ruby_version_is ''...'2.8' do + require_relative 'shared/length' + require 'rexml/document' + + describe "REXML::Attributes#length" do + it_behaves_like :rexml_attribute_length, :length + end end diff --git a/spec/ruby/library/rexml/attributes/namespaces_spec.rb b/spec/ruby/library/rexml/attributes/namespaces_spec.rb index 9e329fef6f..80c40ccc90 100644 --- a/spec/ruby/library/rexml/attributes/namespaces_spec.rb +++ b/spec/ruby/library/rexml/attributes/namespaces_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#namespaces" do - it "needs to be reviewed for spec completeness" +ruby_version_is ''...'2.8' do + require 'rexml/document' + + describe "REXML::Attributes#namespaces" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/rexml/attributes/prefixes_spec.rb b/spec/ruby/library/rexml/attributes/prefixes_spec.rb index 4675095aad..2c1e3f8705 100644 --- a/spec/ruby/library/rexml/attributes/prefixes_spec.rb +++ b/spec/ruby/library/rexml/attributes/prefixes_spec.rb @@ -1,24 +1,27 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#prefixes" do - before :each do - @e = REXML::Element.new("root") - a1 = REXML::Attribute.new("xmlns:a", "bar") - a2 = REXML::Attribute.new("xmlns:b", "bla") - a3 = REXML::Attribute.new("xmlns:c", "baz") - @e.attributes << a1 - @e.attributes << a2 - @e.attributes << a3 +ruby_version_is ''...'2.8' do + require 'rexml/document' - @e.attributes << REXML::Attribute.new("xmlns", "foo") - end + describe "REXML::Attributes#prefixes" do + before :each do + @e = REXML::Element.new("root") + a1 = REXML::Attribute.new("xmlns:a", "bar") + a2 = REXML::Attribute.new("xmlns:b", "bla") + a3 = REXML::Attribute.new("xmlns:c", "baz") + @e.attributes << a1 + @e.attributes << a2 + @e.attributes << a3 - it "returns an array with the prefixes of each attribute" do - @e.attributes.prefixes.sort.should == ["a", "b", "c"] - end + @e.attributes << REXML::Attribute.new("xmlns", "foo") + end + + it "returns an array with the prefixes of each attribute" do + @e.attributes.prefixes.sort.should == ["a", "b", "c"] + end - it "does not include the default namespace" do - @e.attributes.prefixes.include?("xmlns").should == false + it "does not include the default namespace" do + @e.attributes.prefixes.include?("xmlns").should == false + end end end diff --git a/spec/ruby/library/rexml/attributes/size_spec.rb b/spec/ruby/library/rexml/attributes/size_spec.rb index 3b1df9510d..e7fad6bd11 100644 --- a/spec/ruby/library/rexml/attributes/size_spec.rb +++ b/spec/ruby/library/rexml/attributes/size_spec.rb @@ -1,7 +1,10 @@ require_relative '../../../spec_helper' -require_relative 'shared/length' -require 'rexml/document' -describe "REXML::Attributes#size" do - it_behaves_like :rexml_attribute_length, :size +ruby_version_is ''...'2.8' do + require_relative 'shared/length' + require 'rexml/document' + + describe "REXML::Attributes#size" do + it_behaves_like :rexml_attribute_length, :size + end end diff --git a/spec/ruby/library/rexml/attributes/to_a_spec.rb b/spec/ruby/library/rexml/attributes/to_a_spec.rb index 1fbf71b683..cc98e4f0d9 100644 --- a/spec/ruby/library/rexml/attributes/to_a_spec.rb +++ b/spec/ruby/library/rexml/attributes/to_a_spec.rb @@ -1,19 +1,22 @@ require_relative '../../../spec_helper' -require 'rexml/document' -describe "REXML::Attributes#to_a" do - it "returns an array with the attributes" do - e = REXML::Element.new("root") - name = REXML::Attribute.new("name", "Dave") - last = REXML::Attribute.new("last_name", "Murray") +ruby_version_is ''...'2.8' do + require 'rexml/document' - e.attributes << name - e.attributes << last + describe "REXML::Attributes#to_a" do + it "returns an array with the attributes" do + e = REXML::Element.new("root") + name = REXML::Attribute.new("name", "Dave") + last = REXML::Attribute.new("last_name", "Murray") - e.attributes.to_a.sort{|a,b|a.to_s<=>b.to_s}.should == [name, last] - end + e.attributes << name + e.attributes << last + + e.attributes.to_a.sort{|a,b|a.to_s<=>b.to_s}.should == [name, last] + end - it "returns an empty array if it has no attributes" do - REXML::Element.new("root").attributes.to_a.should == [] + it "returns an empty array if it has no attributes" do + REXML::Element.new("root").attributes.to_a.should == [] + end end end |