diff options
Diffstat (limited to 'spec/ruby/library/rexml/attributes')
18 files changed, 0 insertions, 362 deletions
diff --git a/spec/ruby/library/rexml/attributes/add_spec.rb b/spec/ruby/library/rexml/attributes/add_spec.rb deleted file mode 100644 index e24e9fabbc..0000000000 --- a/spec/ruby/library/rexml/attributes/add_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 deleted file mode 100644 index f96a727f47..0000000000 --- a/spec/ruby/library/rexml/attributes/append_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 deleted file mode 100644 index 707baa235b..0000000000 --- a/spec/ruby/library/rexml/attributes/delete_all_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - require 'rexml/document' - - describe "REXML::Attributes#delete_all" do - before :each do - @e = REXML::Element.new("root") - 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 - end - end -end diff --git a/spec/ruby/library/rexml/attributes/delete_spec.rb b/spec/ruby/library/rexml/attributes/delete_spec.rb deleted file mode 100644 index 723fa70751..0000000000 --- a/spec/ruby/library/rexml/attributes/delete_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - require 'rexml/document' - - describe "REXML::Attributes#delete" do - before :each do - @e = REXML::Element.new("root") - @name = REXML::Attribute.new("name", "Pepe") - 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 - 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 deleted file mode 100644 index 692cf4f943..0000000000 --- a/spec/ruby/library/rexml/attributes/each_attribute_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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 - - 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 - end - end -end diff --git a/spec/ruby/library/rexml/attributes/each_spec.rb b/spec/ruby/library/rexml/attributes/each_spec.rb deleted file mode 100644 index 49add3b77b..0000000000 --- a/spec/ruby/library/rexml/attributes/each_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 - end - attributes = attributes.sort_by {|a| a.first } - attributes.first.should == ["name", "Joe"] - attributes.last.should == ["xmlns:ns", "http://some_uri"] - end - end -end diff --git a/spec/ruby/library/rexml/attributes/element_reference_spec.rb b/spec/ruby/library/rexml/attributes/element_reference_spec.rb deleted file mode 100644 index 0d089eaab2..0000000000 --- a/spec/ruby/library/rexml/attributes/element_reference_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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 - - 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 - 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 deleted file mode 100644 index 834ad682a6..0000000000 --- a/spec/ruby/library/rexml/attributes/element_set_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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 - - 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 - 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 deleted file mode 100644 index 1109ff519c..0000000000 --- a/spec/ruby/library/rexml/attributes/get_attribute_ns_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 deleted file mode 100644 index cc94191729..0000000000 --- a/spec/ruby/library/rexml/attributes/get_attribute_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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 - - it "fetches an attributes" do - @e.attributes.get_attribute("name").should == @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 "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 - end - end -end diff --git a/spec/ruby/library/rexml/attributes/initialize_spec.rb b/spec/ruby/library/rexml/attributes/initialize_spec.rb deleted file mode 100644 index 42ec742e60..0000000000 --- a/spec/ruby/library/rexml/attributes/initialize_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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) - - 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" - end - end -end diff --git a/spec/ruby/library/rexml/attributes/length_spec.rb b/spec/ruby/library/rexml/attributes/length_spec.rb deleted file mode 100644 index 81733b4a96..0000000000 --- a/spec/ruby/library/rexml/attributes/length_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 deleted file mode 100644 index b88346854f..0000000000 --- a/spec/ruby/library/rexml/attributes/namespaces_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 deleted file mode 100644 index 574b7ffbaf..0000000000 --- a/spec/ruby/library/rexml/attributes/prefixes_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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 - - @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 - end - end -end diff --git a/spec/ruby/library/rexml/attributes/shared/add.rb b/spec/ruby/library/rexml/attributes/shared/add.rb deleted file mode 100644 index 872f149f45..0000000000 --- a/spec/ruby/library/rexml/attributes/shared/add.rb +++ /dev/null @@ -1,17 +0,0 @@ -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 diff --git a/spec/ruby/library/rexml/attributes/shared/length.rb b/spec/ruby/library/rexml/attributes/shared/length.rb deleted file mode 100644 index 7848f9bf33..0000000000 --- a/spec/ruby/library/rexml/attributes/shared/length.rb +++ /dev/null @@ -1,13 +0,0 @@ -require_relative '../../../../spec_helper' -require 'rexml/document' - -describe :rexml_attribute_length, shared: true do - it "returns the number of attributes" do - e = REXML::Element.new("root") - e.attributes.send(@method).should == 0 - - e.attributes << REXML::Attribute.new("name", "John") - e.attributes << REXML::Attribute.new("another_name", "Leo") - e.attributes.send(@method).should == 2 - end -end diff --git a/spec/ruby/library/rexml/attributes/size_spec.rb b/spec/ruby/library/rexml/attributes/size_spec.rb deleted file mode 100644 index 13ef08f644..0000000000 --- a/spec/ruby/library/rexml/attributes/size_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' 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 deleted file mode 100644 index 902cd86a29..0000000000 --- a/spec/ruby/library/rexml/attributes/to_a_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require_relative '../../../spec_helper' - -ruby_version_is ''...'3.0' do - 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") - - 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 == [] - end - end -end |