summaryrefslogtreecommitdiff
path: root/spec/ruby/library/rexml/element/namespaces_spec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-01-12 08:14:26 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2020-01-12 12:28:29 +0900
commite61cab3a367c4040a2a487dd893c7be9a37889a9 (patch)
treec6ea3e3c929fcb5fd17197abea387173912f624b /spec/ruby/library/rexml/element/namespaces_spec.rb
parent83240f315a10b42b53c3b62c1fbc428f97912665 (diff)
Ignore rexml examples on ruby/spec
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2832
Diffstat (limited to 'spec/ruby/library/rexml/element/namespaces_spec.rb')
-rw-r--r--spec/ruby/library/rexml/element/namespaces_spec.rb51
1 files changed, 27 insertions, 24 deletions
diff --git a/spec/ruby/library/rexml/element/namespaces_spec.rb b/spec/ruby/library/rexml/element/namespaces_spec.rb
index a84c1d1dab..7bf8ec6421 100644
--- a/spec/ruby/library/rexml/element/namespaces_spec.rb
+++ b/spec/ruby/library/rexml/element/namespaces_spec.rb
@@ -1,32 +1,35 @@
-require 'rexml/document'
require_relative '../../../spec_helper'
-describe "REXML::Element#namespaces" do
- before :each do
- doc = REXML::Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
- @elem = doc.elements["//c"]
- end
+ruby_version_is ''...'2.8' do
+ require 'rexml/document'
- it "returns a hash of the namespaces" do
- ns = {"y"=>"2", "z"=>"3", "xmlns"=>"1"}
- @elem.namespaces.keys.sort.should == ns.keys.sort
- @elem.namespaces.values.sort.should == ns.values.sort
- end
+ describe "REXML::Element#namespaces" do
+ before :each do
+ doc = REXML::Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
+ @elem = doc.elements["//c"]
+ end
- it "returns an empty hash if no namespaces exist" do
- e = REXML::Element.new "element"
- e.namespaces.kind_of?(Hash).should == true
- e.namespaces.should be_empty
- end
+ it "returns a hash of the namespaces" do
+ ns = {"y"=>"2", "z"=>"3", "xmlns"=>"1"}
+ @elem.namespaces.keys.sort.should == ns.keys.sort
+ @elem.namespaces.values.sort.should == ns.values.sort
+ end
- it "uses namespace prefixes as keys" do
- prefixes = ["y", "z", "xmlns"]
- @elem.namespaces.keys.sort.should == prefixes.sort
- end
+ it "returns an empty hash if no namespaces exist" do
+ e = REXML::Element.new "element"
+ e.namespaces.kind_of?(Hash).should == true
+ e.namespaces.should be_empty
+ end
- it "uses namespace values as the hash values" do
- values = ["2", "3", "1"]
- @elem.namespaces.values.sort.should == values.sort
- end
+ it "uses namespace prefixes as keys" do
+ prefixes = ["y", "z", "xmlns"]
+ @elem.namespaces.keys.sort.should == prefixes.sort
+ end
+
+ it "uses namespace values as the hash values" do
+ values = ["2", "3", "1"]
+ @elem.namespaces.values.sort.should == values.sort
+ end
+ end
end